Skip to content
This repository was archived by the owner on Oct 30, 2026. It is now read-only.

Commit ca54b45

Browse files
committed
Skip malformed real requests before fixture setup
1 parent 85e7c34 commit ca54b45

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎tests/mock_vws/fixtures/vuforia_backends.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,14 @@ class VuforiaBackend(Enum):
377377
# jobs, and cannot be raised or reset, so signed requests run against the real
378378
# Vuforia only when this option is given.
379379
VERIFY_MODEL_TARGET_SIGNING_OPTION = "--verify-model-target-signing"
380+
_INVALID_JSON_REAL_NODE_ID_PREFIX = (
381+
"tests/mock_vws/test_invalid_json.py::TestInvalidJSON::test_invalid_json["
382+
"Real Vuforia-"
383+
)
384+
_INVALID_JSON_REAL_SKIP_REASON = (
385+
"Real Vuforia can leave malformed-body requests open indefinitely; the "
386+
"mock backends still verify this contract."
387+
)
380388

381389

382390
@beartype
@@ -413,7 +421,7 @@ def pytest_collection_modifyitems(
413421
config: pytest.Config,
414422
items: list[pytest.Item],
415423
) -> None:
416-
"""Skip Docker tests if requested."""
424+
"""Apply configured and infrastructure-specific test skips."""
417425
skip_docker_build_tests_option = "--skip-docker_build_tests"
418426
skip_docker_build_tests_marker = pytest.mark.skip(
419427
reason=(
@@ -426,6 +434,13 @@ def pytest_collection_modifyitems(
426434
if "requires_docker_build" in item.keywords:
427435
item.add_marker(marker=skip_docker_build_tests_marker)
428436

437+
invalid_json_real_marker = pytest.mark.skip(
438+
reason=_INVALID_JSON_REAL_SKIP_REASON,
439+
)
440+
for item in items:
441+
if item.nodeid.startswith(_INVALID_JSON_REAL_NODE_ID_PREFIX):
442+
item.add_marker(marker=invalid_json_real_marker)
443+
429444

430445
@beartype
431446
def _setup_backend(

‎tests/mock_vws/test_invalid_json.py‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from vws_auth_tools import authorization_header, rfc_1123_date
1212

1313
from mock_vws._constants import ResultCodes
14-
from tests.mock_vws.fixtures.vuforia_backends import VuforiaBackend
1514
from tests.mock_vws.utils import Endpoint
1615
from tests.mock_vws.utils.assertions import (
1716
assert_valid_date_header,
@@ -44,19 +43,10 @@ class TestInvalidJSON:
4443
def test_invalid_json(
4544
endpoint: Endpoint,
4645
content: bytes,
47-
verify_mock_vuforia: VuforiaBackend,
4846
) -> None:
4947
"""Giving invalid, non-object or non-UTF-8 JSON returns error
5048
responses.
5149
"""
52-
if verify_mock_vuforia is VuforiaBackend.REAL:
53-
pytest.skip(
54-
reason=(
55-
"Real Vuforia can leave malformed-body requests open "
56-
"indefinitely; the mock backends still verify this "
57-
"contract."
58-
),
59-
)
6050
gmt = ZoneInfo(key="GMT")
6151
now = datetime.now(tz=gmt)
6252
time_to_freeze = now

0 commit comments

Comments
 (0)