diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-07-01 21:49:11 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-07-01 21:49:11 +0200 |
| commit | 909433fa506dc3c8412cecb4439049acb9a3f447 (patch) | |
| tree | 719ccfa21cabcc1558ffcab91c7dc3f0a06d2dca /django | |
| parent | a521d103227be4e5660cf7a66bf98003696aa781 (diff) | |
Removed tests for django.utils.unittest vs. unittest.
Silenced warnings caused by the deprecation of django.utils.unittest.
Thanks Preston Timmons and Carl Meyer for their advice.
Fixed #20680.
Diffstat (limited to 'django')
| -rw-r--r-- | django/test/simple.py | 2 | ||||
| -rw-r--r-- | django/test/utils.py | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/django/test/simple.py b/django/test/simple.py index 874cfdff39..019eff2421 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -12,6 +12,8 @@ from django.db.models import get_app, get_apps from django.test import _doctest as doctest from django.test import runner from django.test.utils import compare_xml, strip_quotes +# django.utils.unittest is deprecated, but so is django.test.simple, +# and the latter will be removed before the former. from django.utils import unittest from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule diff --git a/django/test/utils.py b/django/test/utils.py index 6be9070009..70ce640239 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -377,13 +377,14 @@ class CaptureQueriesContext(object): class IgnoreDeprecationWarningsMixin(object): - warning_class = DeprecationWarning + warning_classes = [DeprecationWarning] def setUp(self): super(IgnoreDeprecationWarningsMixin, self).setUp() self.catch_warnings = warnings.catch_warnings() self.catch_warnings.__enter__() - warnings.filterwarnings("ignore", category=self.warning_class) + for warning_class in self.warning_classes: + warnings.filterwarnings("ignore", category=warning_class) def tearDown(self): self.catch_warnings.__exit__(*sys.exc_info()) @@ -392,7 +393,12 @@ class IgnoreDeprecationWarningsMixin(object): class IgnorePendingDeprecationWarningsMixin(IgnoreDeprecationWarningsMixin): - warning_class = PendingDeprecationWarning + warning_classes = [PendingDeprecationWarning] + + +class IgnoreAllDeprecationWarningsMixin(IgnoreDeprecationWarningsMixin): + + warning_classes = [PendingDeprecationWarning, DeprecationWarning] @contextmanager |
