diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 2c718c54f..13c92f20c 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -606,7 +606,7 @@ 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() @@ -614,7 +614,7 @@ def test_block_manually(self, django_db_blocker): @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):