mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 00:48:45 +00:00
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."""
|
"""Test the bash utility."""
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
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."""
|
"""Test optional returning of shell output on incorrect command."""
|
||||||
session = BashProcess(return_err_output=True)
|
session = BashProcess(return_err_output=True)
|
||||||
output = session.run(["invalid_command"])
|
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:
|
def test_create_directory_and_files(tmp_path: Path) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user