Skip to content

Commit

Permalink
Lock/unlock of db breaks if pytest is executed twice in the same proc…
Browse files Browse the repository at this point in the history
…ess (#1148)

Fixes #1147
  • Loading branch information
boxed authored Sep 28, 2024
1 parent 23adcbe commit 259fb85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,13 @@ def get_order_number(test: pytest.Item) -> int:
items.sort(key=get_order_number)


def pytest_unconfigure(config: pytest.Config) -> None:
if blocking_manager_key not in config.stash:
return
blocking_manager = config.stash[blocking_manager_key]
blocking_manager.unblock()


@pytest.fixture(autouse=True, scope="session")
def django_test_environment(request: pytest.FixtureRequest) -> Generator[None, None, None]:
"""Setup Django's test environment for the testing session.
Expand Down

0 comments on commit 259fb85

Please sign in to comment.