summaryrefslogtreecommitdiff
path: root/tests/test_runner
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-07-01 21:49:11 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-07-01 21:49:11 +0200
commit909433fa506dc3c8412cecb4439049acb9a3f447 (patch)
tree719ccfa21cabcc1558ffcab91c7dc3f0a06d2dca /tests/test_runner
parenta521d103227be4e5660cf7a66bf98003696aa781 (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 'tests/test_runner')
-rw-r--r--tests/test_runner/test_discover_runner.py33
-rw-r--r--tests/test_runner/tests.py5
2 files changed, 5 insertions, 33 deletions
diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
index b4f04e8bb0..4494b2bd3b 100644
--- a/tests/test_runner/test_discover_runner.py
+++ b/tests/test_runner/test_discover_runner.py
@@ -6,11 +6,6 @@ from unittest import expectedFailure
from django.test import TestCase
from django.test.runner import DiscoverRunner
-try:
- import unittest2
-except ImportError:
- unittest2 = None
-
def expectedFailureIf(condition):
"""Marks a test as an expected failure if ``condition`` is met."""
@@ -26,7 +21,7 @@ class DiscoverRunnerTest(TestCase):
["test_discovery_sample.tests_sample"],
).countTestCases()
- self.assertEqual(count, 3)
+ self.assertEqual(count, 2)
def test_dotted_test_class_vanilla_unittest(self):
count = DiscoverRunner().build_suite(
@@ -35,13 +30,6 @@ class DiscoverRunnerTest(TestCase):
self.assertEqual(count, 1)
- def test_dotted_test_class_unittest2(self):
- count = DiscoverRunner().build_suite(
- ["test_discovery_sample.tests_sample.TestUnittest2"],
- ).countTestCases()
-
- self.assertEqual(count, 1)
-
def test_dotted_test_class_django_testcase(self):
count = DiscoverRunner().build_suite(
["test_discovery_sample.tests_sample.TestDjangoTestCase"],
@@ -49,23 +37,6 @@ class DiscoverRunnerTest(TestCase):
self.assertEqual(count, 1)
- # this test fails if unittest2 is installed from PyPI on Python 2.6
- # refs https://code.djangoproject.com/ticket/20437
- @expectedFailureIf(sys.version_info < (2, 7) and unittest2)
- def test_dotted_test_method_vanilla_unittest(self):
- count = DiscoverRunner().build_suite(
- ["test_discovery_sample.tests_sample.TestVanillaUnittest.test_sample"],
- ).countTestCases()
-
- self.assertEqual(count, 1)
-
- def test_dotted_test_method_unittest2(self):
- count = DiscoverRunner().build_suite(
- ["test_discovery_sample.tests_sample.TestUnittest2.test_sample"],
- ).countTestCases()
-
- self.assertEqual(count, 1)
-
def test_dotted_test_method_django_testcase(self):
count = DiscoverRunner().build_suite(
["test_discovery_sample.tests_sample.TestDjangoTestCase.test_sample"],
@@ -96,4 +67,4 @@ class DiscoverRunnerTest(TestCase):
["test_discovery_sample/"],
).countTestCases()
- self.assertEqual(count, 4)
+ self.assertEqual(count, 3)
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 28ae0833c9..4e9e44bc12 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -12,7 +12,7 @@ from django.core.management import call_command
from django import db
from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature
from django.test.testcases import connections_support_transactions
-from django.test.utils import IgnoreDeprecationWarningsMixin
+from django.test.utils import IgnoreAllDeprecationWarningsMixin
from django.utils.importlib import import_module
from admin_scripts.tests import AdminScriptTestCase
@@ -225,7 +225,8 @@ class Ticket17477RegressionTests(AdminScriptTestCase):
self.assertNoOutput(err)
-class ModulesTestsPackages(IgnoreDeprecationWarningsMixin, unittest.TestCase):
+class ModulesTestsPackages(IgnoreAllDeprecationWarningsMixin, unittest.TestCase):
+
def test_get_tests(self):
"Check that the get_tests helper function can find tests in a directory"
from django.test.simple import get_tests