File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,8 @@ def pytest_report_header(config: pytest.Config) -> list[str] | None:
378
378
379
379
380
380
# Convert Django test tags on test classes to pytest marks.
381
+ # Unlike the Django test runner, we only check tags on Django
382
+ # test classes, to keep the plugin's effect contained.
381
383
def pytest_collectstart (collector : pytest .Collector ) -> None :
382
384
if "django" not in sys .modules :
383
385
return
@@ -389,9 +391,9 @@ def pytest_collectstart(collector: pytest.Collector) -> None:
389
391
if not tags :
390
392
return
391
393
392
- from django .test import TransactionTestCase
394
+ from django .test import SimpleTestCase
393
395
394
- if not issubclass (collector .obj , TransactionTestCase ):
396
+ if not issubclass (collector .obj , SimpleTestCase ):
395
397
return
396
398
397
399
for tag in tags :
@@ -410,9 +412,9 @@ def pytest_itemcollected(item: pytest.Item) -> None:
410
412
if not tags :
411
413
return
412
414
413
- from django .test import TransactionTestCase
415
+ from django .test import SimpleTestCase
414
416
415
- if not issubclass (item .cls , TransactionTestCase ):
417
+ if not issubclass (item .cls , SimpleTestCase ):
416
418
return
417
419
418
420
for tag in tags :
Original file line number Diff line number Diff line change 1
1
import pytest
2
- from django .test import TestCase , tag
2
+ from django .test import SimpleTestCase , TestCase , tag
3
3
4
4
from .helpers import DjangoPytester
5
5
@@ -58,7 +58,7 @@ def tearDown(self) -> None:
58
58
59
59
60
60
@tag ("tag1" , "tag2" )
61
- class TestDjangoTagsToPytestMarkers (TestCase ):
61
+ class TestDjangoTagsToPytestMarkers (SimpleTestCase ):
62
62
"""Django test tags are converted to Pytest markers, at the class & method
63
63
levels."""
64
64
You can’t perform that action at this time.
0 commit comments