mirror of https://github.com/zulip/zulip.git
casper: Fix issues with server autoreloading on save.
This fixes an issue where if you saved a Python file (even just changing whitespace) while casper tests were running, the Tornado server being used would restart, triggering a confusing error like this: ReferenceError: Can't find variable: $ Traceback: undefined:2 :4 Suite explicitly interrupted without any message given.
This commit is contained in:
parent
af8732fd42
commit
25488b550f
|
@ -96,10 +96,13 @@ if options.interface is None:
|
|||
elif options.interface == "":
|
||||
options.interface = None
|
||||
|
||||
runserver_args = []
|
||||
base_port = 9991
|
||||
if options.test:
|
||||
base_port = 9981
|
||||
settings_module = "zproject.test_settings"
|
||||
# Don't auto-reload when running casper tests
|
||||
runserver_args = ['--noreload']
|
||||
else:
|
||||
settings_module = "zproject.settings"
|
||||
|
||||
|
@ -154,7 +157,7 @@ pid_file.close()
|
|||
# zulip/urls.py.
|
||||
cmds = [['./tools/compile-handlebars-templates', 'forever'],
|
||||
['./manage.py', 'runserver'] +
|
||||
manage_args + ['127.0.0.1:%d' % (django_port,)],
|
||||
manage_args + runserver_args + ['127.0.0.1:%d' % (django_port,)],
|
||||
['env', 'PYTHONUNBUFFERED=1', './manage.py', 'runtornado'] +
|
||||
manage_args + ['127.0.0.1:%d' % (tornado_port,)],
|
||||
['./tools/run-dev-queue-processors'] + manage_args,
|
||||
|
|
|
@ -19,5 +19,6 @@ def create_tornado_application():
|
|||
return tornado.web.Application(([(url, AsyncDjangoHandler) for url in urls] +
|
||||
get_sockjs_router().urls),
|
||||
debug=settings.DEBUG,
|
||||
autoreload=settings.AUTORELOAD,
|
||||
# Disable Tornado's own request logging, since we have our own
|
||||
log_function=lambda x: None)
|
||||
|
|
|
@ -363,6 +363,7 @@ ZILENCER_ENABLED = 'zilencer' in INSTALLED_APPS
|
|||
# We override the port number when running frontend tests.
|
||||
TORNADO_SERVER = 'http://127.0.0.1:9993'
|
||||
RUNNING_INSIDE_TORNADO = False
|
||||
AUTORELOAD = DEBUG
|
||||
|
||||
########################################################################
|
||||
# DATABASE CONFIGURATION
|
||||
|
|
|
@ -96,8 +96,12 @@ CACHES['database'] = {
|
|||
}
|
||||
}
|
||||
|
||||
# Use local memory cache for backend tests.
|
||||
if not CASPER_TESTS:
|
||||
|
||||
if CASPER_TESTS:
|
||||
# Don't auto-restart Tornado server during casper tests
|
||||
AUTORELOAD = False
|
||||
else:
|
||||
# Use local memory cache for backend tests.
|
||||
CACHES['default'] = {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue