Skip to content

Commit

Permalink
rere.py
Browse files Browse the repository at this point in the history
  • Loading branch information
atharvakale343 committed Sep 20, 2024
1 parent 0205a23 commit d66fa72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/rere.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def capture(shell: str) -> dict:
print(f"RUNNING: {new_shell}")
process = subprocess.run(['sh', '-c', new_shell])
return {
'shell': shell,
'shell': new_shell,
'returncode': 0,
'stdout': b'',
'stderr': b'',
Expand Down Expand Up @@ -147,7 +147,13 @@ def load_snapshots(file_path: str) -> list[dict]:
print(f" ACTUAL: {shell}")
print(f"NOTE: You may want to do `{program_name} record {test_list_path}` to update {test_list_path}.bi")
exit(1)
process = subprocess.run(['sh', '-c', shell], capture_output = True);
if shell.startswith("(NOCAPTURE)"):
new_shell = " ".join(shell.split(" ")[1:])
process = subprocess.run(['sh', '-c', new_shell])
process.stdout = b''
process.stderr = b''
else:
process = subprocess.run(['sh', '-c', shell], capture_output = True)
failed = False
if process.returncode != snapshot['returncode']:
print(f"UNEXPECTED: return code")
Expand Down

0 comments on commit d66fa72

Please sign in to comment.