mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	testing: Flush API_KEYS before every test.
This makes our test performance for each test more consistent.
This commit is contained in:
		@@ -64,6 +64,11 @@ import six
 | 
			
		||||
 | 
			
		||||
API_KEYS = {} # type: Dict[Text, Text]
 | 
			
		||||
 | 
			
		||||
def flush_caches_for_testing():
 | 
			
		||||
    # type: () -> None
 | 
			
		||||
    global API_KEYS
 | 
			
		||||
    API_KEYS = {}
 | 
			
		||||
 | 
			
		||||
class UploadSerializeMixin(SerializeMixin):
 | 
			
		||||
    """
 | 
			
		||||
    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.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.test_helpers import (
 | 
			
		||||
    get_all_templates, write_instrumentation_reports,
 | 
			
		||||
@@ -111,6 +112,7 @@ def run_test(test, result):
 | 
			
		||||
    test_name = full_test_name(test)
 | 
			
		||||
 | 
			
		||||
    bounce_key_prefix_for_testing(test_name)
 | 
			
		||||
    flush_caches_for_testing()
 | 
			
		||||
 | 
			
		||||
    if not hasattr(test, "_pre_setup"):
 | 
			
		||||
        # test_name is likely of the form unittest.loader.ModuleImportFailure.zerver.tests.test_upload
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user