Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/mock_vws/_requests_mock_server/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re
from contextlib import ContextDecorator
from typing import TYPE_CHECKING, Literal, Self
from typing import Literal, Self
from urllib.parse import urljoin, urlparse

from beartype import BeartypeConf, beartype
Expand All @@ -22,9 +22,6 @@
from .mock_web_query_api import MockVuforiaWebQueryAPI
from .mock_web_services_api import MockVuforiaWebServicesAPI

if TYPE_CHECKING:
from collections.abc import Iterable

_STRUCTURAL_SIMILARITY_MATCHER = StructuralSimilarityMatcher()
_BRISQUE_TRACKING_RATER = BrisqueTargetTrackingRater()

Expand Down Expand Up @@ -130,19 +127,13 @@ def __enter__(self) -> Self:
Returns:
``self``.
"""
compiled_url_patterns: Iterable[re.Pattern[str]] = set()

mock = RequestsMock(assert_all_requests_are_fired=False)
for vws_route in self._mock_vws_api.routes:
url_pattern = urljoin(
base=self._base_vws_url,
url=f"{vws_route.path_pattern}$",
)
compiled_url_pattern = re.compile(pattern=url_pattern)
compiled_url_patterns = {
*compiled_url_patterns,
compiled_url_pattern,
}

for vws_http_method in vws_route.http_methods:
mock.add_callback(
Expand All @@ -158,10 +149,6 @@ def __enter__(self) -> Self:
url=f"{vwq_route.path_pattern}$",
)
compiled_url_pattern = re.compile(pattern=url_pattern)
compiled_url_patterns = {
*compiled_url_patterns,
compiled_url_pattern,
}

for vwq_http_method in vwq_route.http_methods:
mock.add_callback(
Expand Down
Loading