From 87d2d6dbfe57ac4f241f4c21107fb63dc899b89e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 17 Jan 2020 21:58:29 +0100 Subject: [PATCH] tests: harden Test_django_db_blocker tests --- tests/test_fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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):