test_classes.py: Add activation to default language.

Running the backend tests with a high number of processes can cause
unexpected errors with language changes.  When certain tests that change
the default language, (without explicitly overriding the teardown method
to reset the default language), interleave with other tests that are
expecting the language to be in English, discrepancies arise.

This fixes a common nondeterministic test failure with high levels of
parallelization.
This commit is contained in:
Wyatt Hoodes
2019-05-05 12:59:02 -10:00
committed by Tim Abbott
parent 1af4f8fe20
commit 2b3de816a8

View File

@@ -16,6 +16,7 @@ from django.db.migrations.executor import MigrationExecutor
from django.db import connection
from django.db.utils import IntegrityError
from django.http import HttpRequest
from django.utils import translation
from two_factor.models import PhoneDevice
from zerver.lib.initial_password import initial_password
@@ -100,6 +101,7 @@ class ZulipTestCase(TestCase):
clear_client_event_queues_for_testing()
clear_supported_auth_backends_cache()
flush_per_request_caches()
translation.activate(settings.LANGUAGE_CODE)
'''
WRAPPER_COMMENT: