Skip to content

Commit 10b2b4b

Browse files
Refactor display boundary inventories to canonical sources
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent ab1f84a commit 10b2b4b

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

tests/test_display_key_format_import_boundary.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33

44
import pytest
55

6+
from tests.test_display_helper_usage import ALLOWED_KEY_FORMAT_CALL_FILES
7+
68
pytestmark = pytest.mark.architecture
79

810

9-
EXPECTED_KEY_FORMAT_HELPER_IMPORTERS = (
10-
"hyperbrowser/client/managers/extension_utils.py",
11-
"hyperbrowser/client/managers/response_utils.py",
12-
"hyperbrowser/client/managers/session_utils.py",
13-
"hyperbrowser/tools/__init__.py",
14-
"hyperbrowser/transport/base.py",
15-
"tests/test_display_utils.py",
16-
)
11+
EXPECTED_EXTRA_IMPORTERS = ("tests/test_display_utils.py",)
1712

1813

1914
def _imports_format_string_key_for_error(module_text: str) -> bool:
@@ -39,4 +34,10 @@ def test_format_string_key_for_error_imports_are_centralized():
3934
if _imports_format_string_key_for_error(module_text):
4035
discovered_modules.append(module_path.as_posix())
4136

42-
assert discovered_modules == list(EXPECTED_KEY_FORMAT_HELPER_IMPORTERS)
37+
expected_modules = sorted(
38+
[
39+
*(f"hyperbrowser/{path.as_posix()}" for path in ALLOWED_KEY_FORMAT_CALL_FILES),
40+
*EXPECTED_EXTRA_IMPORTERS,
41+
]
42+
)
43+
assert discovered_modules == expected_modules

tests/test_display_normalize_import_boundary.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33

44
import pytest
55

6+
from tests.test_display_helper_usage import ALLOWED_NORMALIZE_DISPLAY_CALL_FILES
7+
68
pytestmark = pytest.mark.architecture
79

810

9-
EXPECTED_NORMALIZE_DISPLAY_IMPORTERS = (
10-
"hyperbrowser/client/managers/response_utils.py",
11-
"hyperbrowser/transport/base.py",
12-
"tests/test_display_utils.py",
13-
)
11+
EXPECTED_EXTRA_IMPORTERS = ("tests/test_display_utils.py",)
1412

1513

1614
def _imports_normalize_display_text(module_text: str) -> bool:
@@ -36,4 +34,10 @@ def test_normalize_display_text_imports_are_centralized():
3634
if _imports_normalize_display_text(module_text):
3735
discovered_modules.append(module_path.as_posix())
3836

39-
assert discovered_modules == list(EXPECTED_NORMALIZE_DISPLAY_IMPORTERS)
37+
expected_runtime_modules = sorted(
38+
f"hyperbrowser/{path.as_posix()}"
39+
for path in ALLOWED_NORMALIZE_DISPLAY_CALL_FILES
40+
if path != Path("display_utils.py")
41+
)
42+
expected_modules = sorted([*expected_runtime_modules, *EXPECTED_EXTRA_IMPORTERS])
43+
assert discovered_modules == expected_modules

0 commit comments

Comments
 (0)