From 81e48c73ca4782d645101dac895b7e1393c582af Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Sun, 1 Mar 2026 19:32:49 +0100 Subject: [PATCH] fix(tests): handle missing schemathesis gracefully in API contract tests - Replaced `pytest.mark.skipif` with `pytest.skip` to better manage scenarios where `schemathesis` is not installed. - Added a fallback test function to ensure explicit handling for missing dependencies. --- backend/tests/e2e/test_api_contracts.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/tests/e2e/test_api_contracts.py b/backend/tests/e2e/test_api_contracts.py index 7a4b922..50af111 100644 --- a/backend/tests/e2e/test_api_contracts.py +++ b/backend/tests/e2e/test_api_contracts.py @@ -27,13 +27,16 @@ except ImportError: pytestmark = [ pytest.mark.e2e, pytest.mark.schemathesis, - pytest.mark.skipif( - not SCHEMATHESIS_AVAILABLE, - reason="schemathesis not installed - run: make install-e2e", - ), ] +if not SCHEMATHESIS_AVAILABLE: + + def test_schemathesis_compatibility(): + """Gracefully handle missing schemathesis dependency.""" + pytest.skip("schemathesis not installed - run: make install-e2e") + + if SCHEMATHESIS_AVAILABLE: from app.main import app