diff --git a/tests/test_init_system.py b/tests/test_init_system.py index a76d724..a433ddc 100644 --- a/tests/test_init_system.py +++ b/tests/test_init_system.py @@ -685,11 +685,19 @@ class TestEdgeCases: def test_runit_collect_missing_script(self): """Runit collect exits when fenris-collect script not found.""" - with patch("fenris.init_system.Path") as mock_path: - mock_path.return_value.exists.return_value = False + with patch("fenris.init_system.subprocess") as mock_sub, \ + patch("fenris.init_system.Path") as mock_path: + missing = MagicMock() + missing.exists.return_value = False + # Fallback path is built via Path(...).parent... / "src" / ... + missing.parent = missing + missing.__truediv__.return_value = missing + mock_path.return_value = missing + mock_sub.run.return_value = MagicMock(returncode=1) with pytest.raises(SystemExit) as exc_info: _runit_collect() assert exc_info.value.code == 1 + mock_sub.run.assert_not_called() def test_systemd_query_state_timeout(self): """Systemd query state handles subprocess timeout."""