test: fix runit missing-script fixture
This commit is contained in:
@@ -685,11 +685,19 @@ class TestEdgeCases:
|
|||||||
|
|
||||||
def test_runit_collect_missing_script(self):
|
def test_runit_collect_missing_script(self):
|
||||||
"""Runit collect exits when fenris-collect script not found."""
|
"""Runit collect exits when fenris-collect script not found."""
|
||||||
with patch("fenris.init_system.Path") as mock_path:
|
with patch("fenris.init_system.subprocess") as mock_sub, \
|
||||||
mock_path.return_value.exists.return_value = False
|
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:
|
with pytest.raises(SystemExit) as exc_info:
|
||||||
_runit_collect()
|
_runit_collect()
|
||||||
assert exc_info.value.code == 1
|
assert exc_info.value.code == 1
|
||||||
|
mock_sub.run.assert_not_called()
|
||||||
|
|
||||||
def test_systemd_query_state_timeout(self):
|
def test_systemd_query_state_timeout(self):
|
||||||
"""Systemd query state handles subprocess timeout."""
|
"""Systemd query state handles subprocess timeout."""
|
||||||
|
|||||||
Reference in New Issue
Block a user