forked from Archives/langchain
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
This commit is contained in:
parent
b706966ebc
commit
a92344f476
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user