Skip to content

Commit

Permalink
only test for stable output
Browse files Browse the repository at this point in the history
  • Loading branch information
youkaichao committed Nov 28, 2023
1 parent 3e738bf commit d1d7100
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_pytorch/cmp_output.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import glob

output_files = glob.glob("depyf_output/*/__*.py")
output_files = glob.glob("depyf_output/*/__compiled_fn_*.py") + glob.glob("depyf_output/*/__transformed_code_*.py")
output_files.sort()

expected_files = glob.glob("tests/depyf_output/*/__*.py")
expected_files = glob.glob("tests/depyf_output/*/__compiled_fn_*.py") + glob.glob("tests/depyf_output/*/__transformed_code_*.py")
expected_files.sort()

assert len(output_files) == len(expected_files), f"len(output_files)={len(output_files)}, len(expected_files)={len(expected_files)}"
Expand All @@ -19,7 +19,7 @@
for line in f:
if line.strip() and not line.strip().startswith("#"):
expected_lines.append(line.strip())
assert len(output_lines) == len(expected_lines), f"len(output_lines)={len(output_lines)}, len(expected_lines)={len(expected_lines)}"
assert len(output_lines) == len(expected_lines), f"output_file={output_file}\nlen(output_lines)={len(output_lines)}\noutput_lines:\n{output_lines}\nexpected_file={expected_file}\nlen(expected_lines)={len(expected_lines)}\noutput_lines:\n{output_lines}\n"
# sometimes the lines are not in the same order, some lines are switched without changing the behavior of the code.
output_lines.sort()
expected_lines.sort()
Expand Down

0 comments on commit d1d7100

Please sign in to comment.