mirror of https://github.com/zulip/zulip.git
testing: Flush API_KEYS before every test.
This makes our test performance for each test more consistent.
This commit is contained in:
parent
ff8ab054da
commit
804c62045f
|
@ -64,6 +64,11 @@ import six
|
||||||
|
|
||||||
API_KEYS = {} # type: Dict[Text, Text]
|
API_KEYS = {} # type: Dict[Text, Text]
|
||||||
|
|
||||||
|
def flush_caches_for_testing():
|
||||||
|
# type: () -> None
|
||||||
|
global API_KEYS
|
||||||
|
API_KEYS = {}
|
||||||
|
|
||||||
class UploadSerializeMixin(SerializeMixin):
|
class UploadSerializeMixin(SerializeMixin):
|
||||||
"""
|
"""
|
||||||
We cannot use override_settings to change upload directory because
|
We cannot use override_settings to change upload directory because
|
||||||
|
|
|
@ -14,6 +14,7 @@ from django.test.signals import template_rendered
|
||||||
|
|
||||||
from zerver.lib import test_classes, test_helpers
|
from zerver.lib import test_classes, test_helpers
|
||||||
from zerver.lib.cache import bounce_key_prefix_for_testing
|
from zerver.lib.cache import bounce_key_prefix_for_testing
|
||||||
|
from zerver.lib.test_classes import flush_caches_for_testing
|
||||||
from zerver.lib.sqlalchemy_utils import get_sqlalchemy_connection
|
from zerver.lib.sqlalchemy_utils import get_sqlalchemy_connection
|
||||||
from zerver.lib.test_helpers import (
|
from zerver.lib.test_helpers import (
|
||||||
get_all_templates, write_instrumentation_reports,
|
get_all_templates, write_instrumentation_reports,
|
||||||
|
@ -111,6 +112,7 @@ def run_test(test, result):
|
||||||
test_name = full_test_name(test)
|
test_name = full_test_name(test)
|
||||||
|
|
||||||
bounce_key_prefix_for_testing(test_name)
|
bounce_key_prefix_for_testing(test_name)
|
||||||
|
flush_caches_for_testing()
|
||||||
|
|
||||||
if not hasattr(test, "_pre_setup"):
|
if not hasattr(test, "_pre_setup"):
|
||||||
# test_name is likely of the form unittest.loader.ModuleImportFailure.zerver.tests.test_upload
|
# test_name is likely of the form unittest.loader.ModuleImportFailure.zerver.tests.test_upload
|
||||||
|
|
Loading…
Reference in New Issue