From 84e7a9f4a7bb3cad2bffae97baaae99de152c451 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 23 Nov 2018 20:59:38 -0500 Subject: Switched setUp() to setUpTestData() where possible in Django's tests. --- tests/test_utils/tests.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests/test_utils') 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: -- cgit v1.3