diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-10-22 20:38:11 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-10-22 22:40:01 -0300 |
| commit | bcc65c13a086f3e6d24dc7fc92a167fd836af501 (patch) | |
| tree | 55d025e8a1e8b7229fafb0fbbd5221db1de699af /tests | |
| parent | 2e74d6cb53a38c4cc08d4a069157be335a486ddd (diff) | |
[1.6.x] Fixed #21307 -- Moved TransRealMixin to django.test.utils.
51d2e1fb23 from master.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/defaultfilters/tests.py | 3 | ||||
| -rw-r--r-- | tests/forms_tests/tests/test_regressions.py | 2 | ||||
| -rw-r--r-- | tests/i18n/__init__.py | 18 | ||||
| -rw-r--r-- | tests/i18n/contenttypes/tests.py | 4 | ||||
| -rw-r--r-- | tests/i18n/tests.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/tests.py | 4 |
6 files changed, 5 insertions, 29 deletions
diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py index ca8d99340a..9daa323c4c 100644 --- a/tests/defaultfilters/tests.py +++ b/tests/defaultfilters/tests.py @@ -6,13 +6,12 @@ import decimal from django.template.defaultfilters import * from django.test import TestCase +from django.test.utils import TransRealMixin from django.utils import six from django.utils import unittest, translation from django.utils.safestring import SafeData from django.utils.encoding import python_2_unicode_compatible -from i18n import TransRealMixin - class DefaultFiltersTests(TestCase): diff --git a/tests/forms_tests/tests/test_regressions.py b/tests/forms_tests/tests/test_regressions.py index d230d68f75..aad95708f4 100644 --- a/tests/forms_tests/tests/test_regressions.py +++ b/tests/forms_tests/tests/test_regressions.py @@ -8,7 +8,7 @@ from django.test import TestCase from django.utils.translation import ugettext_lazy, override from forms_tests.models import Cheese -from i18n import TransRealMixin +from django.test.utils import TransRealMixin class FormsRegressionsTestCase(TransRealMixin, TestCase): diff --git a/tests/i18n/__init__.py b/tests/i18n/__init__.py index c5aaa31fe3..e69de29bb2 100644 --- a/tests/i18n/__init__.py +++ b/tests/i18n/__init__.py @@ -1,18 +0,0 @@ -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 = {} - trans_real._checked_languages = {} - - def tearDown(self): - self.flush_caches() - super(TransRealMixin, self).tearDown() diff --git a/tests/i18n/contenttypes/tests.py b/tests/i18n/contenttypes/tests.py index cbac9ec5da..c48f8fc6dd 100644 --- a/tests/i18n/contenttypes/tests.py +++ b/tests/i18n/contenttypes/tests.py @@ -5,13 +5,11 @@ import os from django.contrib.contenttypes.models import ContentType from django.test import TestCase -from django.test.utils import override_settings +from django.test.utils import override_settings, TransRealMixin from django.utils._os import upath from django.utils import six from django.utils import translation -from i18n import TransRealMixin - @override_settings( USE_I18N=True, diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index ae9d9f1970..4be0fbf2ac 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -12,7 +12,7 @@ from django.core.management.utils import find_command from django.template import Template, Context from django.template.base import TemplateSyntaxError from django.test import TestCase, RequestFactory -from django.test.utils import override_settings +from django.test.utils import override_settings, TransRealMixin from django.utils import translation from django.utils.formats import (get_format, date_format, time_format, localize, localize_input, iter_format_modules, get_format_modules, @@ -44,7 +44,6 @@ if find_command('msgfmt'): from .commands.compilation import (PoFileTests, PoFileContentsTests, PercentRenderingTests, MultipleLocaleCompilationTests, CompilationErrorHandling) -from . import TransRealMixin from .forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm from .models import Company, TestModel diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 879acc15de..72d8631c8a 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -22,7 +22,7 @@ from django.template import (base as template_base, loader, Context, from django.template.loaders import app_directories, filesystem, cached from django.test import RequestFactory, TestCase from django.test.utils import (setup_test_template_loader, - restore_template_loaders, override_settings) + restore_template_loaders, override_settings, TransRealMixin) from django.utils import unittest from django.utils.encoding import python_2_unicode_compatible from django.utils.formats import date_format @@ -33,8 +33,6 @@ from django.utils import six from django.utils.six.moves.urllib.parse import urljoin from django.utils.tzinfo import LocalTimezone -from i18n import TransRealMixin - try: from .loaders import RenderToStringTest, EggLoaderTest except ImportError as e: |
