Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy code, PROJECT_PATH and related test case code_tests #5429

Merged
merged 4 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/installguide/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ Known issues
* **Chrome 55-56** has issues scrolling the menus on touch devices. Upgrading to Chrome 57 fixes this. :url-issue:`5407`
* **Windows** needs at least Python 2.7.11. The Windows installer for KA Lite will install the latest version of Python. If you installed KA Lite in another way, and your Python installation is more than a year old, you probably have to upgrade Python - you can fetch the latest 2.7.12 version `here <https://www.python.org/downloads/windows/>`__.
* **Windows** installer tray application option "Run on start" does not work, see `learningequality/installers#106 <https://github.com/learningequality/installers/issues/106>`__ (also contains `a work-around`<https://github.com/learningequality/installers/issues/106#issuecomment-237729680>__)
* **Windows + IE9** One-Click device registration is broken. Work-around: Use a different browser or use manual device registration. :url-issue:`5409`
* **Firefox 47**: Subtitles are misaligned in the video player. This is fixed by upgrading Firefox.


Code cleanup
^^^^^^^^^^^^

* Remove ``PROJECT_PATH`` from ``kalite.settings.base`` (it wasn't a configurable setting). :url-issue:`4104`
* Make tests run on Selenium 3.3+ and geckodriver 0.15 (Firefox) :url-issue:`5429`

0.17.0
------

Expand Down
8 changes: 5 additions & 3 deletions kalite/distributed/management/commands/screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Command(BaseCommand):
action='store',
dest='output_dir',
default=None,
help='Specify the output directory relative to the project base directory.'),
help='Specify the output directory relative to current working directory.'),
make_option('--no-del',
action='store_true',
dest='no_del',
Expand Down Expand Up @@ -184,8 +184,10 @@ def __init__(self, *args, **kwargs):

# make sure output path exists and is empty
if kwargs['output_dir']:
self.output_path = os.path.join( os.path.realpath(os.path.join(settings.PROJECT_PATH, '..')),
kwargs['output_dir'])
self.output_path = os.path.join(
os.path.realpath(os.getcwd()),
kwargs['output_dir']
)
else:
self.output_path = settings.SCREENSHOTS_OUTPUT_PATH
ensure_dir(self.output_path)
Expand Down
17 changes: 6 additions & 11 deletions kalite/distributed/management/commands/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError

from kalite import ROOT_DATA_PATH
import kalite
from kalite.facility.models import Facility
from kalite.version import VERSION, SHORTVERSION
from kalite.i18n.base import CONTENT_PACK_URL_TEMPLATE, reset_content_db
Expand All @@ -42,7 +42,7 @@
CONTENTPACK_URL = CONTENT_PACK_URL_TEMPLATE.format(
version=SHORTVERSION, langcode="en", suffix="")

PRESEED_DIR = os.path.join(ROOT_DATA_PATH, "preseed")
PRESEED_DIR = os.path.join(kalite.ROOT_DATA_PATH, "preseed")

# Examples:
# contentpack.en.zip
Expand Down Expand Up @@ -477,15 +477,10 @@ def handle(self, *args, **options):
if not settings.CENTRAL_SERVER:

kalite_executable = 'kalite'
if not spawn.find_executable('kalite'):
if os.name == 'posix':
start_script_path = os.path.realpath(
os.path.join(settings.PROJECT_PATH, "..", "bin", kalite_executable))
else:
start_script_path = os.path.realpath(
os.path.join(settings.PROJECT_PATH, "..", "bin", "windows", "kalite.bat"))
else:

This comment was marked as spam.

This comment was marked as spam.

if spawn.find_executable(kalite_executable):
start_script_path = kalite_executable
else:
start_script_path = None

# Run annotate_content_items, on the distributed server.
print("Annotating availability of all content, checking for content in this directory: (%s)" %
Expand All @@ -501,7 +496,7 @@ def handle(self, *args, **options):
print(
"You can now start KA Lite with the following command:\n\n\t%s start\n\n" % start_script_path)

if options['interactive']:
if options['interactive'] and start_script_path:
if raw_input_yn("Do you wish to start the server now?"):
print("Running {0} start".format(start_script_path))
p = subprocess.Popen(
Expand Down
1 change: 0 additions & 1 deletion kalite/distributed/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from code_tests import *
from url_tests import *
from browser_tests import *
172 changes: 0 additions & 172 deletions kalite/distributed/tests/code_tests.py

This file was deleted.

6 changes: 0 additions & 6 deletions kalite/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@

_data_path = ROOT_DATA_PATH

# BEING DEPRECATED, PLEASE DO NOT USE PROJECT_PATH!
PROJECT_PATH = os.environ.get(
"KALITE_HOME",
os.path.join(os.path.expanduser("~"), ".kalite")
)


###################################################
# CHANNEL and CONTENT DATA
Expand Down
9 changes: 7 additions & 2 deletions kalite/testing/testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_options():
option_info = {"--behave_browser": True}

for fixed, keywords in options:
# Look for the long version of this option
# Look for the long of this option
long_option = None
for option in fixed:
if option.startswith("--"):
Expand Down Expand Up @@ -170,7 +170,12 @@ def build_suite(self, test_labels, extra_tests, **kwargs):
# Output Firefox version, needed to understand Selenium compatibility
# issues
browser = webdriver.Firefox()
logging.info("Successfully setup Firefox {0}".format(browser.capabilities['version']))
browser_version = getattr(
browser.capabilities,
'browserVersion', # Selenium 3+
browser.capabilities.get('version', None) # Selenium 2
)
logging.info("Successfully setup Firefox {0}".format(browser_version))
browser.quit()

if not database_exists() or os.path.getsize(database_path()) < 1024 * 1024:
Expand Down