Skip to content

Commit

Permalink
tests: harden Test_django_db_blocker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jan 23, 2020
1 parent f725579 commit 87d2d6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,15 +606,15 @@ class Test_django_db_blocker:
def test_block_manually(self, django_db_blocker):
try:
django_db_blocker.block()
with pytest.raises(RuntimeError):
with pytest.raises(RuntimeError, match="^Database access not allowed,"):
Item.objects.exists()
finally:
django_db_blocker.restore()

@pytest.mark.django_db
def test_block_with_block(self, django_db_blocker):
with django_db_blocker.block():
with pytest.raises(RuntimeError):
with pytest.raises(RuntimeError, match="^Database access not allowed,"):
Item.objects.exists()

def test_unblock_manually(self, django_db_blocker):
Expand Down

0 comments on commit 87d2d6d

Please sign in to comment.