summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-07 07:02:21 +0200
committerGitHub <noreply@github.com>2022-04-07 07:02:21 +0200
commit2ee4caf56b8e000cabbb73ad81ff05738d6d0a35 (patch)
tree235be4c93977ad91f8fae7517b4e5b8ad629db32 /tests/test_utils
parentbfe9665502c77baf14ce6cf52af974033bd43164 (diff)
Refs #33173 -- Fixed test_runner/test_utils tests on Python 3.11+.
Python 3.11 uses fully qualified test name in unittest output. See https://github.com/python/cpython/commit/755be9b1505af591b9f2ee424a6525b6c2b65ce9
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/tests.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index e704ed5dc1..6a4467fdcb 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -48,6 +48,7 @@ from django.test.utils import (
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
from django.utils.deprecation import RemovedInDjango50Warning
from django.utils.log import DEFAULT_LOGGING
+from django.utils.version import PY311
from .models import Car, Person, PossessedCar
from .views import empty_response
@@ -100,9 +101,11 @@ class SkippingTestCase(SimpleTestCase):
SkipTestCase("test_foo").test_foo,
ValueError,
"skipUnlessDBFeature cannot be used on test_foo (test_utils.tests."
- "SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase) "
+ "SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase%s) "
"as SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase "
- "doesn't allow queries against the 'default' database.",
+ "doesn't allow queries against the 'default' database."
+ # Python 3.11 uses fully qualified test name in the output.
+ % (".test_foo" if PY311 else ""),
)
def test_skip_if_db_feature(self):
@@ -145,9 +148,11 @@ class SkippingTestCase(SimpleTestCase):
SkipTestCase("test_foo").test_foo,
ValueError,
"skipIfDBFeature cannot be used on test_foo (test_utils.tests."
- "SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase) "
+ "SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase%s) "
"as SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase "
- "doesn't allow queries against the 'default' database.",
+ "doesn't allow queries against the 'default' database."
+ # Python 3.11 uses fully qualified test name in the output.
+ % (".test_foo" if PY311 else ""),
)