mirror of
https://github.com/django/django.git
synced 2024-11-18 07:26:04 +00:00
18 lines
556 B
Python
18 lines
556 B
Python
from threading import local
|
|
|
|
|
|
class TransRealMixin(object):
|
|
"""This is the only way to reset the translation machinery. Otherwise
|
|
the test suite occasionally fails because of global state pollution
|
|
between tests."""
|
|
def flush_caches(self):
|
|
from django.utils.translation import trans_real
|
|
trans_real._translations = {}
|
|
trans_real._active = local()
|
|
trans_real._default = None
|
|
trans_real._accepted = {}
|
|
|
|
def tearDown(self):
|
|
self.flush_caches()
|
|
super(TransRealMixin, self).tearDown()
|