Skip to content
Snippets Groups Projects
Commit 36cb7edd authored by Hans Fangohr's avatar Hans Fangohr
Browse files

check exceptions are raised (as for subprocess.run)

parent 4db287b7
No related branches found
No related tags found
2 merge requests!19Move linux-debian11 into main,!14Draft: Add tests for run method
......@@ -45,6 +45,16 @@ def test_run_method(tmp_path):
in run(["echo", "Hello, world!"], capture_output=True).stdout
)
# check exceptions
with pytest.raises(FileNotFoundError):
run(["doesnotexistcommand"])
# check error code is checked
# 1. expect this to parse: return code is non-zero, but we don't check
run(["ls", "/doesnotexist"]),
# 2. expect this to fail:
with pytest.raises(subprocess.CalledProcessError):
run(["ls", "/doesnotexist"], check=True)
def test_prepare_environment(tmp_path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment