Skip to content

Commit a0bac7b

Browse files
committed
Fix test_command_not_found_error to expect FileNotFoundError on Linux
subprocess.run() raises FileNotFoundError on Linux when the command doesn't exist, rather than returning a result with non-zero exit code. Changed test to use pytest.raises(FileNotFoundError) instead of checking result.returncode. Fixes final Ubuntu CI test failure.
1 parent 1c4e376 commit a0bac7b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

tests/test_edge_cases.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,13 @@ class TestErrorMessages:
331331

332332
def test_command_not_found_error(self):
333333
"""Test error message when command is not installed."""
334-
# Mock a command that doesn't exist
335-
result = sp.run(
336-
["nonexistent-command-hook"],
337-
stdout=sp.PIPE,
338-
stderr=sp.PIPE,
339-
)
340-
# Should fail with non-zero exit code
341-
assert result.returncode != 0
334+
# Mock a command that doesn't exist - should raise FileNotFoundError
335+
with pytest.raises(FileNotFoundError):
336+
sp.run(
337+
["nonexistent-command-hook"],
338+
stdout=sp.PIPE,
339+
stderr=sp.PIPE,
340+
)
342341

343342
def test_version_mismatch_error_format(self):
344343
"""Test version mismatch error message format."""

0 commit comments

Comments
 (0)