Skip to content

Commit d07a967

Browse files
authored
tests: harden Test_django_db_blocker tests (#803)
1 parent ab218f3 commit d07a967

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,15 @@ class Test_django_db_blocker:
725725
def test_block_manually(self, django_db_blocker: DjangoDbBlocker) -> None:
726726
try:
727727
django_db_blocker.block()
728-
with pytest.raises(RuntimeError):
728+
with pytest.raises(RuntimeError, match="^Database access not allowed,"):
729729
Item.objects.exists()
730730
finally:
731731
django_db_blocker.restore()
732732

733733
@pytest.mark.django_db
734734
def test_block_with_block(self, django_db_blocker: DjangoDbBlocker) -> None:
735735
with django_db_blocker.block():
736-
with pytest.raises(RuntimeError):
736+
with pytest.raises(RuntimeError, match="^Database access not allowed,"):
737737
Item.objects.exists()
738738

739739
def test_unblock_manually(self, django_db_blocker: DjangoDbBlocker) -> None:

0 commit comments

Comments
 (0)