77pytestmark = pytest .mark .architecture
88
99HYPERBROWSER_ROOT = Path (__file__ ).resolve ().parents [1 ] / "hyperbrowser"
10- ALLOWED_PARSE_MAPPING_LIST_CALL_FILES = {
10+ LIST_PARSING_HELPER_RUNTIME_MODULES = {
1111 Path ("client/managers/extension_utils.py" ),
1212 Path ("client/managers/list_parsing_utils.py" ),
1313 Path ("client/managers/session_utils.py" ),
1414}
15- ALLOWED_READ_PLAIN_LIST_CALL_FILES = {
16- Path ( "client/managers/extension_utils.py" ),
17- Path ( "client/managers/list_parsing_utils.py" ),
18- Path ("client/managers/session_utils .py" ),
15+ LIST_PARSING_HELPER_CALLER_MODULES = {
16+ path
17+ for path in LIST_PARSING_HELPER_RUNTIME_MODULES
18+ if path != Path ("client/managers/list_parsing_utils .py" )
1919}
20+ ALLOWED_PARSE_MAPPING_LIST_CALL_FILES = LIST_PARSING_HELPER_CALLER_MODULES
21+ ALLOWED_READ_PLAIN_LIST_CALL_FILES = LIST_PARSING_HELPER_CALLER_MODULES
2022
2123
2224def _python_files () -> list [Path ]:
2325 return sorted (HYPERBROWSER_ROOT .rglob ("*.py" ))
2426
2527
2628def test_parse_mapping_list_items_usage_is_centralized ():
29+ files_with_calls : set [Path ] = set ()
2730 violations : list [str ] = []
2831
2932 for path in _python_files ():
@@ -32,15 +35,18 @@ def test_parse_mapping_list_items_usage_is_centralized():
3235 helper_calls = collect_name_call_lines (module , "parse_mapping_list_items" )
3336 if not helper_calls :
3437 continue
38+ files_with_calls .add (relative_path )
3539 if relative_path in ALLOWED_PARSE_MAPPING_LIST_CALL_FILES :
3640 continue
3741 for line in helper_calls :
3842 violations .append (f"{ relative_path } :{ line } " )
3943
4044 assert violations == []
45+ assert files_with_calls == ALLOWED_PARSE_MAPPING_LIST_CALL_FILES
4146
4247
4348def test_read_plain_list_items_usage_is_centralized ():
49+ files_with_calls : set [Path ] = set ()
4450 violations : list [str ] = []
4551
4652 for path in _python_files ():
@@ -49,9 +55,11 @@ def test_read_plain_list_items_usage_is_centralized():
4955 helper_calls = collect_name_call_lines (module , "read_plain_list_items" )
5056 if not helper_calls :
5157 continue
58+ files_with_calls .add (relative_path )
5259 if relative_path in ALLOWED_READ_PLAIN_LIST_CALL_FILES :
5360 continue
5461 for line in helper_calls :
5562 violations .append (f"{ relative_path } :{ line } " )
5663
5764 assert violations == []
65+ assert files_with_calls == ALLOWED_READ_PLAIN_LIST_CALL_FILES
0 commit comments