Skip to content

Commit 5c21625

Browse files
committed
Add test for ordering with Django test classes
1 parent c65dc70 commit 5c21625

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_db_setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def test_db_order(django_testdir):
3434

3535
django_testdir.create_test_module('''
3636
import pytest
37+
from django.test import TestCase, TransactionTestCase
3738
3839
from .app.models import Item
3940
@@ -50,14 +51,24 @@ def test_run_first_fixture(db):
5051
@pytest.mark.django_db
5152
def test_run_first_decorator():
5253
pass
54+
55+
class MyTestCase(TestCase):
56+
def test_run_first_test_case(self):
57+
pass
58+
59+
class MyTransactionTestCase(TransactionTestCase):
60+
def test_run_second_transaction_test_case(self):
61+
pass
5362
''')
5463
result = django_testdir.runpytest_subprocess('-v', '-s')
5564
assert result.ret == 0
5665
result.stdout.fnmatch_lines([
5766
"*test_run_first_fixture*",
5867
"*test_run_first_decorator*",
68+
"*test_run_first_test_case*",
5969
"*test_run_second_decorator*",
6070
"*test_run_second_fixture*",
71+
"*test_run_second_transaction_test_case*",
6172
])
6273

6374

0 commit comments

Comments
 (0)