summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-16 08:09:52 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-20 21:23:01 +0200
commit2e10abeb7f375d56dca21b1baed11f98e74ab7f5 (patch)
tree0aaf6d27f18a1724a4a95dc5093ea36ea9981b1c /tests
parent97237ad3feed80407ed1884ea84cf00fd9fea367 (diff)
Refs #31395 -- Removed support for assigning objects which don't support deepcopy() in setUpTestData().
Per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_utils/test_testcase.py24
1 files changed, 1 insertions, 23 deletions
diff --git a/tests/test_utils/test_testcase.py b/tests/test_utils/test_testcase.py
index 9b11168b13..1261006092 100644
--- a/tests/test_utils/test_testcase.py
+++ b/tests/test_utils/test_testcase.py
@@ -1,9 +1,8 @@
from functools import wraps
from django.db import IntegrityError, connections, transaction
-from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
+from django.test import TestCase, skipUnlessDBFeature
from django.test.testcases import TestData
-from django.utils.deprecation import RemovedInDjango41Warning
from .models import Car, Person, PossessedCar
@@ -54,11 +53,6 @@ class TestTestCase(TestCase):
self.reset_sequences = old_reset_sequences
-class NonDeepCopyAble:
- def __deepcopy__(self, memo):
- raise TypeError
-
-
def assert_no_queries(test):
@wraps(test)
def inner(self):
@@ -79,7 +73,6 @@ class TestDataTests(TestCase):
car=cls.car,
belongs_to=cls.jim_douglas,
)
- cls.non_deepcopy_able = NonDeepCopyAble()
@assert_no_queries
def test_class_attribute_equality(self):
@@ -104,21 +97,6 @@ class TestDataTests(TestCase):
self.assertIs(self.herbie.car, self.car)
self.assertIs(self.herbie.belongs_to, self.jim_douglas)
- @ignore_warnings(category=RemovedInDjango41Warning)
- def test_undeepcopyable(self):
- self.assertIs(self.non_deepcopy_able, self.__class__.non_deepcopy_able)
-
- def test_undeepcopyable_warning(self):
- msg = (
- "Assigning objects which don't support copy.deepcopy() during "
- "setUpTestData() is deprecated. Either assign the "
- "non_deepcopy_able attribute during setUpClass() or setUp(), or "
- "add support for deepcopy() to "
- "test_utils.test_testcase.TestDataTests.non_deepcopy_able."
- )
- with self.assertRaisesMessage(RemovedInDjango41Warning, msg):
- self.non_deepcopy_able
-
def test_repr(self):
self.assertEqual(
repr(TestData('attr', 'value')),