summaryrefslogtreecommitdiff
path: root/tests/queries
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-11-23 21:24:25 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-05-15 20:22:56 +0200
commit94f63b926fd32d7a7b6e2591ef72aa8f040f25cc (patch)
tree427aa4855f08fa75d386118765fcb0035ea07052 /tests/queries
parent3cf80d3fcf7446afdde16a2be515c423f720e54d (diff)
Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.
Diffstat (limited to 'tests/queries')
-rw-r--r--tests/queries/test_bulk_update.py5
-rw-r--r--tests/queries/tests.py12
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/queries/test_bulk_update.py b/tests/queries/test_bulk_update.py
index ec43c86691..be794df718 100644
--- a/tests/queries/test_bulk_update.py
+++ b/tests/queries/test_bulk_update.py
@@ -12,8 +12,9 @@ from .models import (
class BulkUpdateNoteTests(TestCase):
- def setUp(self):
- self.notes = [
+ @classmethod
+ def setUpTestData(cls):
+ cls.notes = [
Note.objects.create(note=str(i), misc=str(i))
for i in range(10)
]
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index bf08e7a421..cd31453d08 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -1962,7 +1962,8 @@ class Queries6Tests(TestCase):
class RawQueriesTests(TestCase):
- def setUp(self):
+ @classmethod
+ def setUpTestData(cls):
Note.objects.create(note='n1', misc='foo', id=1)
def test_ticket14729(self):
@@ -1986,10 +1987,11 @@ class GeneratorExpressionTests(SimpleTestCase):
class ComparisonTests(TestCase):
- def setUp(self):
- self.n1 = Note.objects.create(note='n1', misc='foo', id=1)
- e1 = ExtraInfo.objects.create(info='e1', note=self.n1)
- self.a2 = Author.objects.create(name='a2', num=2002, extra=e1)
+ @classmethod
+ def setUpTestData(cls):
+ cls.n1 = Note.objects.create(note='n1', misc='foo', id=1)
+ e1 = ExtraInfo.objects.create(info='e1', note=cls.n1)
+ cls.a2 = Author.objects.create(name='a2', num=2002, extra=e1)
def test_ticket8597(self):
# Regression tests for case-insensitive comparisons