1919sys .path .insert (0 , str (_SCRIPTS_DIR ))
2020
2121from detect_affected_models import ( # noqa: E402
22+ _SRC_ROOT ,
2223 _build_class_to_source_module ,
2324 _build_import_graph ,
2425 _build_registry_class_to_types ,
2526 _build_source_module_to_types ,
2627 _find_reverse_dependents ,
27- _SRC_ROOT ,
2828 classify_file ,
2929 detect_affected_models ,
3030)
@@ -287,9 +287,7 @@ def test_shared_infra_still_triggers_run_all(self):
287287 "tests/_test_configs.py" ,
288288 ]:
289289 result = detect_affected_models ([path ])
290- assert result ["run_all" ] is True , (
291- f"{ path } should trigger run_all but didn't"
292- )
290+ assert result ["run_all" ] is True , f"{ path } should trigger run_all but didn't"
293291
294292 def test_traceable_and_model_combined (self ):
295293 """A component + model file change returns union of affected types."""
@@ -316,9 +314,7 @@ def test_traceable_overridden_by_shared_infra(self):
316314
317315 def test_deleted_traceable_file_triggers_run_all (self ):
318316 """A deleted component file triggers run_all (conservative)."""
319- result = detect_affected_models (
320- ["src/mobius/components/_nonexistent_component.py" ]
321- )
317+ result = detect_affected_models (["src/mobius/components/_nonexistent_component.py" ])
322318 assert result ["run_all" ] is True
323319
324320
@@ -335,33 +331,23 @@ def test_attention_component_finds_model_dependents(self):
335331 import_graph = _build_import_graph (_SRC_ROOT )
336332 registry_map = _build_source_module_to_types ()
337333
338- dependents = _find_reverse_dependents (
339- "mobius.components._attention" , import_graph
340- )
334+ dependents = _find_reverse_dependents ("mobius.components._attention" , import_graph )
341335 # At minimum, models that use Attention should appear
342336 affected_types : set [str ] = set ()
343337 for dep in dependents :
344338 if dep in registry_map :
345339 affected_types .update (registry_map [dep ])
346- assert len (affected_types ) > 0 , (
347- "Expected _attention.py to affect at least one model"
348- )
340+ assert len (affected_types ) > 0 , "Expected _attention.py to affect at least one model"
349341
350342 def test_traceable_result_is_subset_of_all_models (self ):
351343 """Traceable tracing should return a subset, not all models."""
352344 # A niche component should affect fewer models than _common.py
353- result_common = detect_affected_models (
354- ["src/mobius/components/_common.py" ]
355- )
356- result_niche = detect_affected_models (
357- ["src/mobius/components/_sam_vision.py" ]
358- )
345+ result_common = detect_affected_models (["src/mobius/components/_common.py" ])
346+ result_niche = detect_affected_models (["src/mobius/components/_sam_vision.py" ])
359347 assert result_common ["run_all" ] is False
360348 assert result_niche ["run_all" ] is False
361349 # Niche component should affect fewer models
362- assert len (result_niche ["affected" ]) <= len (
363- result_common ["affected" ]
364- ), (
350+ assert len (result_niche ["affected" ]) <= len (result_common ["affected" ]), (
365351 f"_sam_vision.py ({ len (result_niche ['affected' ])} models) should "
366352 f"affect <= models than _common.py ({ len (result_common ['affected' ])} )"
367353 )
0 commit comments