diff --git a/tests/test_mpsd_software.py b/tests/test_mpsd_software.py
index 6ef1d0d825467466a15c336cad5add41ff85a98e..7b4fd77b3d7de1369d01013767ab1ccec0df6ccb 100644
--- a/tests/test_mpsd_software.py
+++ b/tests/test_mpsd_software.py
@@ -190,13 +190,16 @@ def test_record_script_execution_summary(tmp_path):
 
 def test_install_environment_wrong_package_set(tmp_path):
     """Test exception is raised for non-existing package_set."""
-    # Expect an Exception when wrong package_sets are provided
-    with pytest.raises(Exception):
+    # exits with exit code 1 when wrong package_sets are provided
+    with pytest.raises(SystemExit) as e:
         mod.install_environment(
             mpsd_release="dev-23a",
             package_sets=["wrong-package_set"],
             root_dir=(tmp_path),
         )
+    assert e.type == SystemExit
+    assert e.value.code == 1
+
 
 
 def test_install_environment_wrong_mpsd_release(tmp_path):