Skip to content

Commit 1c79545

Browse files
Add list parsing helper import boundary guard
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 100ede0 commit 1c79545

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ This runs lint, format checks, compile checks, tests, and package build.
168168
- `tests/test_job_wait_helper_boundary.py` (centralization boundary enforcement for wait-for-job helper primitives),
169169
- `tests/test_job_wait_helper_usage.py` (shared wait-for-job defaults helper usage enforcement),
170170
- `tests/test_list_parsing_helper_usage.py` (list parsing shared helper usage centralization),
171+
- `tests/test_list_parsing_helpers_import_boundary.py` (list parsing helper import boundary enforcement),
171172
- `tests/test_list_parsing_key_display_helper_usage.py` (list parsing safe key-display helper usage enforcement),
172173
- `tests/test_makefile_quality_targets.py` (Makefile quality-gate target enforcement),
173174
- `tests/test_manager_helper_import_boundary.py` (manager helper-import boundary enforcement for low-level parse modules),

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"tests/test_job_request_helper_usage.py",
128128
"tests/test_job_start_payload_helper_usage.py",
129129
"tests/test_job_query_params_helper_usage.py",
130+
"tests/test_list_parsing_helpers_import_boundary.py",
130131
"tests/test_list_parsing_key_display_helper_usage.py",
131132
"tests/test_list_parsing_helper_usage.py",
132133
"tests/test_job_wait_helper_boundary.py",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
pytestmark = pytest.mark.architecture
6+
7+
8+
EXPECTED_LIST_PARSING_HELPER_IMPORTERS = (
9+
"hyperbrowser/client/managers/extension_utils.py",
10+
"hyperbrowser/client/managers/session_utils.py",
11+
"tests/test_list_parsing_helpers_import_boundary.py",
12+
"tests/test_list_parsing_utils.py",
13+
)
14+
15+
16+
def test_list_parsing_helper_imports_are_centralized():
17+
discovered_modules: list[str] = []
18+
19+
for module_path in sorted(Path("hyperbrowser").rglob("*.py")):
20+
module_text = module_path.read_text(encoding="utf-8")
21+
if "list_parsing_utils import" not in module_text:
22+
continue
23+
discovered_modules.append(module_path.as_posix())
24+
25+
for module_path in sorted(Path("tests").glob("test_*.py")):
26+
module_text = module_path.read_text(encoding="utf-8")
27+
if "list_parsing_utils import" not in module_text:
28+
continue
29+
discovered_modules.append(module_path.as_posix())
30+
31+
assert discovered_modules == list(EXPECTED_LIST_PARSING_HELPER_IMPORTERS)

0 commit comments

Comments
 (0)