Skip to content

Commit

Permalink
tests: fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Feb 28, 2025
1 parent 812fee6 commit 9743e17
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,11 @@ def test_shell_file(args: list[str], runner: CliRunner):
# test running the shell tool with a filename
# make sure we don't accidentally expand the filename and include it in the shell command
# create new file with contents
with open("test.txt", "w") as f:
f.write("yes")
args.append("/shell cat test.txt")
result = runner.invoke(gptme.cli.main, args)
with runner.isolated_filesystem():
with open("test.txt", "w") as f:
f.write("yes")
args.append("/shell cat test.txt")
result = runner.invoke(gptme.cli.main, args)
output_pre, output_post = result.output.split("System", 1)
# check for no 'yes' in parsed input (only direct command output)
assert output_pre.count("yes") == 1, output_pre
Expand Down

0 comments on commit 9743e17

Please sign in to comment.