Skip to content

Commit

Permalink
Add Django main to tox envlist.
Browse files Browse the repository at this point in the history
  • Loading branch information
hramezani committed Nov 15, 2021
1 parent ac76775 commit 5597c92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def _django_db_fixture_helper(
transactional: bool = False,
reset_sequences: bool = False,
) -> None:
from django import VERSION

if is_django_unittest(request):
return

Expand Down Expand Up @@ -174,7 +176,19 @@ class PytestDjangoTestCase(test_case_class): # type: ignore[misc,valid-type]
if _databases is not None:
databases = _databases

@classmethod
def django_tear_down_class(cls) -> None:
cls._remove_databases_failures()
if hasattr(cls, '_cls_modified_context'):
cls._cls_modified_context.disable()
delattr(cls, '_cls_modified_context')
if hasattr(cls, '_cls_overridden_context'):
cls._cls_overridden_context.disable()
delattr(cls, '_cls_overridden_context')

PytestDjangoTestCase.setUpClass()
if VERSION >= (4, 0):
request.addfinalizer(PytestDjangoTestCase.django_tear_down_class)
request.addfinalizer(PytestDjangoTestCase.tearDownClass)

test_case = PytestDjangoTestCase(methodName="__init__")
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
envlist =
py310-dj32-postgres
py39-dj{32,31,30,22}-postgres
py38-dj{32,31,30,22}-postgres
py310-dj{main,32}-postgres
py39-dj{main,32,31,30,22}-postgres
py38-dj{main,32,31,30,22}-postgres
py37-dj{32,31,30,22}-postgres
py36-dj{32,31,30,22}-postgres
py35-dj{22}-postgres
Expand Down

0 comments on commit 5597c92

Please sign in to comment.