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.
This commit is contained in:
@@ -27,13 +27,16 @@ except ImportError:
|
|||||||
pytestmark = [
|
pytestmark = [
|
||||||
pytest.mark.e2e,
|
pytest.mark.e2e,
|
||||||
pytest.mark.schemathesis,
|
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:
|
if SCHEMATHESIS_AVAILABLE:
|
||||||
from app.main import app
|
from app.main import app
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user