You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(slm): four executor tests fail when run alone — they stub services as a MagicMock, which is not a package #20746
Four SLM tests load services/playbook_executor.py by file path, after stubbing sys.modules["services"] with a MagicMock. Run on their own, three fail to collect and one fails:
The error is ModuleNotFoundError: No module named 'services.git_failure'; 'services' is not a package. A MagicMock has no real __path__, so any services.* module the executor imports that isn't in the stub list can't load. The executor has gained such imports over time (services.git_failure, services.playbook_code_source_gate, and others).
Whether they pass in the full suite depends on whether an earlier test already imported those modules. Their result therefore depends on test order.
Fix
Use one shared loader for these tests that leaves the real services package in place and stubs only the modules that reach the network or the DB. tests/test_no_restart_sync_20743.py (#20743) does this already. Alternatively, stub services as a real types.ModuleType with a __path__.
Acceptance criteria
Each of the four files passes when run on its own.
They share one loader instead of four copies of the stub list.
Activity