From a92344f476fc3f18599442790a1423505eec9eb4 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Tue, 21 Mar 2023 12:06:52 -0400 Subject: [PATCH] Use regex match for bash process error output test assertion. (#1837) I was getting the same issue reported in #1339 by [MacYang555](https://github.com/MacYang555) when running the test suite on my Mac. I implemented the fix they suggested to use a regex match in the output assertion for the scenario under test. Resolves #1339 --- tests/unit_tests/test_bash.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_bash.py b/tests/unit_tests/test_bash.py index 157b1c9c..aa5a30f1 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: