diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 709ae6c9..94f79fa6 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -725,7 +725,7 @@ class Test_django_db_blocker: def test_block_manually(self, django_db_blocker: DjangoDbBlocker) -> None: 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() @@ -733,7 +733,7 @@ def test_block_manually(self, django_db_blocker: DjangoDbBlocker) -> None: @pytest.mark.django_db def test_block_with_block(self, django_db_blocker: DjangoDbBlocker) -> None: 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: DjangoDbBlocker) -> None: