Skip to content

Commit 90b371e

Browse files
Refactor mapping boundary inventory to canonical targets
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent a88b099 commit 90b371e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tests/test_mapping_reader_usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
pytestmark = pytest.mark.architecture
1212

13-
_TARGET_FILES = (
13+
MAPPING_READER_TARGET_FILES = (
1414
Path("hyperbrowser/client/managers/response_utils.py"),
1515
Path("hyperbrowser/transport/base.py"),
1616
Path("hyperbrowser/client/managers/list_parsing_utils.py"),
@@ -21,7 +21,7 @@ def test_core_mapping_parsers_use_shared_mapping_reader():
2121
violations: list[str] = []
2222
missing_reader_calls: list[str] = []
2323

24-
for relative_path in _TARGET_FILES:
24+
for relative_path in MAPPING_READER_TARGET_FILES:
2525
module = read_module_ast(relative_path)
2626
list_keys_calls = collect_list_keys_call_lines(module)
2727
if list_keys_calls:

tests/test_mapping_utils_import_boundary.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33

44
import pytest
55

6+
from tests.test_mapping_reader_usage import MAPPING_READER_TARGET_FILES
7+
68
pytestmark = pytest.mark.architecture
79

810

9-
EXPECTED_MAPPING_UTILS_IMPORTERS = (
10-
"hyperbrowser/client/managers/list_parsing_utils.py",
11-
"hyperbrowser/client/managers/response_utils.py",
12-
"hyperbrowser/tools/__init__.py",
13-
"hyperbrowser/transport/base.py",
14-
"tests/test_mapping_utils.py",
15-
)
11+
EXPECTED_MAPPING_EXTRA_IMPORTERS = ("tests/test_mapping_utils.py",)
12+
MAPPING_TOOL_IMPORTER = Path("hyperbrowser/tools/__init__.py")
1613

1714

1815
def _imports_mapping_utils(module_text: str) -> bool:
@@ -39,4 +36,8 @@ def test_mapping_utils_imports_are_centralized():
3936
if _imports_mapping_utils(module_text):
4037
discovered_modules.append(module_path.as_posix())
4138

42-
assert discovered_modules == list(EXPECTED_MAPPING_UTILS_IMPORTERS)
39+
expected_runtime_modules = sorted(
40+
[*(path.as_posix() for path in MAPPING_READER_TARGET_FILES), MAPPING_TOOL_IMPORTER.as_posix()]
41+
)
42+
expected_modules = sorted([*expected_runtime_modules, *EXPECTED_MAPPING_EXTRA_IMPORTERS])
43+
assert discovered_modules == expected_modules

0 commit comments

Comments
 (0)