@@ -29,9 +29,11 @@ def test_db_order(django_testdir) -> None:
2929 """Test order in which tests are being executed."""
3030
3131 django_testdir .create_test_module ('''
32- from unittest import TestCase
3332 import pytest
34- from django.test import SimpleTestCase, TestCase as DjangoTestCase, TransactionTestCase
33+ from unittest import TestCase
34+ from django.test import SimpleTestCase
35+ from django.test import TestCase as DjangoTestCase
36+ from django.test import TransactionTestCase
3537
3638 from .app.models import Item
3739
@@ -45,13 +47,32 @@ def test_run_second_fixture(transactional_db):
4547 def test_run_second_reset_sequences_fixture(django_db_reset_sequences):
4648 pass
4749
50+ class MyTransactionTestCase(TransactionTestCase):
51+ def test_run_second_transaction_test_case(self):
52+ pass
53+
4854 def test_run_first_fixture(db):
4955 pass
5056
57+ class TestClass:
58+ def test_run_second_fixture_class(self, transactional_db):
59+ pass
60+
61+ def test_run_first_fixture_class(self, db):
62+ pass
63+
5164 @pytest.mark.django_db(reset_sequences=True)
5265 def test_run_second_reset_sequences_decorator():
5366 pass
5467
68+ class MyDjangoTestCase(DjangoTestCase):
69+ def test_run_first_django_test_case(self):
70+ pass
71+
72+ class MySimpleTestCase(SimpleTestCase):
73+ def test_run_last_simple_test_case(self):
74+ pass
75+
5576 @pytest.mark.django_db
5677 def test_run_first_decorator():
5778 pass
@@ -63,34 +84,24 @@ def test_run_first_serialized_rollback_decorator():
6384 class MyTestCase(TestCase):
6485 def test_run_last_test_case(self):
6586 pass
66-
67- class MySimpleTestCase(SimpleTestCase):
68- def test_run_last_simple_test_case(self):
69- pass
70-
71- class MyDjangoTestCase(DjangoTestCase):
72- def test_run_first_django_test_case(self):
73- pass
74-
75- class MyTransactionTestCase(TransactionTestCase):
76- def test_run_second_transaction_test_case(self):
77- pass
7887 ''' )
7988 result = django_testdir .runpytest_subprocess ('-q' , '--collect-only' )
8089 assert result .ret == 0
8190 result .stdout .fnmatch_lines ([
8291 "*test_run_first_fixture*" ,
92+ "*test_run_first_fixture_class*" ,
93+ "*test_run_first_django_test_case*" ,
8394 "*test_run_first_decorator*" ,
8495 "*test_run_first_serialized_rollback_decorator*" ,
85- "*test_run_first_django_test_case*" ,
8696 "*test_run_second_decorator*" ,
8797 "*test_run_second_fixture*" ,
8898 "*test_run_second_reset_sequences_fixture*" ,
89- "*test_run_second_reset_sequences_decorator*" ,
9099 "*test_run_second_transaction_test_case*" ,
91- "*test_run_last_test_case*" ,
100+ "*test_run_second_fixture_class*" ,
101+ "*test_run_second_reset_sequences_decorator*" ,
92102 "*test_run_last_simple_test_case*" ,
93- ])
103+ "*test_run_last_test_case*" ,
104+ ], consecutive = True )
94105
95106
96107def test_db_reuse (django_testdir ) -> None :
0 commit comments