We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6d8804 commit d19ed96Copy full SHA for d19ed96
pytest_django/plugin.py
@@ -417,7 +417,20 @@ def pytest_runtest_setup(item):
417
418
@pytest.hookimpl(tryfirst=True)
419
def pytest_collection_modifyitems(items):
420
+ # If Django is not configured we don't need to bother
421
+ if not django_settings_is_configured():
422
+ return
423
+
424
+ from django.test import TestCase, TransactionTestCase
425
426
def get_order_number(test):
427
+ if hasattr(test, "cls") and test.cls:
428
+ # Beware, TestCase is a subclass of TransactionTestCase
429
+ if issubclass(test.cls, TestCase):
430
+ return 0
431
+ if issubclass(test.cls, TransactionTestCase):
432
+ return 1
433
434
marker_db = test.get_closest_marker('django_db')
435
if marker_db:
436
transaction = validate_django_db(marker_db)[0]
0 commit comments