From dd94c1a86492edc6a3cb0f0b8799aaa2d065601e Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Mon, 14 Feb 2022 15:02:37 +0000 Subject: [PATCH] test: improve tests for `@queries_records` #296 - Previously, asserting the status code was unreachable --- test/test_queries_records.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_queries_records.py b/test/test_queries_records.py index 6e66b858..7cc07819 100644 --- a/test/test_queries_records.py +++ b/test/test_queries_records.py @@ -30,7 +30,10 @@ def test_valid_error_raised( def raise_exception(): raise raised_exception() - with pytest.raises(expected_exception) as ctx: + try: raise_exception() + except Exception as e: + assert e.status_code == status_code - assert ctx.exception.status_code == status_code + with pytest.raises(expected_exception): + raise_exception()