mirror of https://github.com/zulip/zulip.git
report: Use DEVELOPMENT instead of DEBUG setting.
This fixes a weird issue where the following sequences of tests would fail: test-backend zerver.tests.test_messages.PersonalMessagesTest.test_personal_to_self zerver.tests.test_report.TestReport.test_report_error zerver.tests.test_templates.TemplateTestCase.test_custom_tos_template It appears that all 3 tests are required for the failure. While it's not entirely clear what the cause is, a very likely factor is that settings.DEBUG is special, and so changing it at runtime is likely to cause weird problems like this. We fix this by replacing it with settings.DEVELOPMENT, which has the same value in all environments, but doesn't have this problem of being a special Django thing.
This commit is contained in:
parent
1c73ddd4c6
commit
a1d296b802
|
@ -145,10 +145,10 @@ class TestReport(ZulipTestCase):
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
# If js_source_map is present, then the stack trace should be annotated.
|
# If js_source_map is present, then the stack trace should be annotated.
|
||||||
# DEBUG=False and TEST_SUITE=False are necessary to ensure that
|
# DEVELOPMENT=False and TEST_SUITE=False are necessary to ensure that
|
||||||
# js_source_map actually gets instantiated.
|
# js_source_map actually gets instantiated.
|
||||||
with \
|
with \
|
||||||
self.settings(DEBUG=False, TEST_SUITE=False), \
|
self.settings(DEVELOPMENT=False, TEST_SUITE=False), \
|
||||||
mock.patch('zerver.lib.unminify.SourceMap.annotate_stacktrace') as annotate:
|
mock.patch('zerver.lib.unminify.SourceMap.annotate_stacktrace') as annotate:
|
||||||
result = self.client_post("/json/report_error", params)
|
result = self.client_post("/json/report_error", params)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
|
@ -24,7 +24,7 @@ js_source_map = None
|
||||||
def get_js_source_map():
|
def get_js_source_map():
|
||||||
# type: () -> Optional[SourceMap]
|
# type: () -> Optional[SourceMap]
|
||||||
global js_source_map
|
global js_source_map
|
||||||
if not js_source_map and not (settings.DEBUG or settings.TEST_SUITE):
|
if not js_source_map and not (settings.DEVELOPMENT or settings.TEST_SUITE):
|
||||||
js_source_map = SourceMap(os.path.join(
|
js_source_map = SourceMap(os.path.join(
|
||||||
settings.DEPLOY_ROOT, 'prod-static/source-map'))
|
settings.DEPLOY_ROOT, 'prod-static/source-map'))
|
||||||
return js_source_map
|
return js_source_map
|
||||||
|
|
Loading…
Reference in New Issue