diff --git a/tests.py b/tests.py index d3652a43ff7579e5694225ae3d42d51c9853b53c..b79ccf1de747c90c5628195cc3a741deff36d6c3 100644 --- a/tests.py +++ b/tests.py @@ -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):