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:
378378
379379
380380# 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.
381383def pytest_collectstart (collector : pytest .Collector ) -> None :
382384 if "django" not in sys .modules :
383385 return
@@ -389,9 +391,9 @@ def pytest_collectstart(collector: pytest.Collector) -> None:
389391 if not tags :
390392 return
391393
392- from django .test import TransactionTestCase
394+ from django .test import SimpleTestCase
393395
394- if not issubclass (collector .obj , TransactionTestCase ):
396+ if not issubclass (collector .obj , SimpleTestCase ):
395397 return
396398
397399 for tag in tags :
@@ -410,9 +412,9 @@ def pytest_itemcollected(item: pytest.Item) -> None:
410412 if not tags :
411413 return
412414
413- from django .test import TransactionTestCase
415+ from django .test import SimpleTestCase
414416
415- if not issubclass (item .cls , TransactionTestCase ):
417+ if not issubclass (item .cls , SimpleTestCase ):
416418 return
417419
418420 for tag in tags :
Original file line number Diff line number Diff line change 11import pytest
2- from django .test import TestCase , tag
2+ from django .test import SimpleTestCase , TestCase , tag
33
44from .helpers import DjangoPytester
55
@@ -58,7 +58,7 @@ def tearDown(self) -> None:
5858
5959
6060@tag ("tag1" , "tag2" )
61- class TestDjangoTagsToPytestMarkers (TestCase ):
61+ class TestDjangoTagsToPytestMarkers (SimpleTestCase ):
6262 """Django test tags are converted to Pytest markers, at the class & method
6363 levels."""
6464
You can’t perform that action at this time.
0 commit comments