summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-11-23 20:59:38 -0500
committerTim Graham <timograham@gmail.com>2018-11-27 09:35:17 -0500
commit84e7a9f4a7bb3cad2bffae97baaae99de152c451 (patch)
treec81eeb6edf47ce0abdb7551cd28a3de354dfd20f /tests/test_utils
parent9a7d336c3866c5226ed11868be0234c7e2fa47fa (diff)
Switched setUp() to setUpTestData() where possible in Django's tests.
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/tests.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index b484518687..320531e32c 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -185,9 +185,10 @@ class AssertNumQueriesUponConnectionTests(TransactionTestCase):
class AssertQuerysetEqualTests(TestCase):
- def setUp(self):
- self.p1 = Person.objects.create(name='p1')
- self.p2 = Person.objects.create(name='p2')
+ @classmethod
+ def setUpTestData(cls):
+ cls.p1 = Person.objects.create(name='p1')
+ cls.p2 = Person.objects.create(name='p2')
def test_ordered(self):
self.assertQuerysetEqual(
@@ -255,8 +256,9 @@ class AssertQuerysetEqualTests(TestCase):
@override_settings(ROOT_URLCONF='test_utils.urls')
class CaptureQueriesContextManagerTests(TestCase):
- def setUp(self):
- self.person_pk = str(Person.objects.create(name='test').pk)
+ @classmethod
+ def setUpTestData(cls):
+ cls.person_pk = str(Person.objects.create(name='test').pk)
def test_simple(self):
with CaptureQueriesContext(connection) as captured_queries: