Skip to content

Commit 5813cd8

Browse files
committed
Lock/unlock of db breaks if pytest is executed twice in the same process (fixes #1147)
1 parent 1157a7c commit 5813cd8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pytest_django/plugin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ def get_order_number(test: pytest.Item) -> int:
476476
items.sort(key=get_order_number)
477477

478478

479+
def pytest_unconfigure(config: pytest.Config) -> None:
480+
blocking_manager = config.stash[blocking_manager_key]
481+
blocking_manager.unblock()
482+
483+
479484
@pytest.fixture(autouse=True, scope="session")
480485
def django_test_environment(request: pytest.FixtureRequest) -> Generator[None, None, None]:
481486
"""Setup Django's test environment for the testing session.

0 commit comments

Comments
 (0)