Skip to content

The agent engineering platform.

Use regex match for bash process error output test assertion. (#1837)

Matt Tuckera92344f476fc
diff --git a/tests/unit_tests/test_bash.py b/tests/unit_tests/test_bash.py
index 157b1c9c62..aa5a30f1b4 100644
--- a/tests/unit_tests/test_bash.py
+++ b/tests/unit_tests/test_bash.py
@@ -1,4 +1,5 @@
"""Test the bash utility."""
+import re
import subprocess
from pathlib import Path
@@ -25,7 +26,7 @@ def test_incorrect_command_return_err_output() -> None:
"""Test optional returning of shell output on incorrect command."""
session = BashProcess(return_err_output=True)
output = session.run(["invalid_command"])
- assert output == "/bin/sh: 1: invalid_command: not found\n"
+ assert re.match(r"^/bin/sh:.*invalid_command.*not found.*$", output)
def test_create_directory_and_files(tmp_path: Path) -> None: