Skip to content

Commit

Permalink
exclude some patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
youkaichao committed Jul 26, 2024
1 parent fd360fb commit 079a69d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_pytorch/cmp_output.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import glob

def exclude_files(files, keys):
return [x for x in files if not any(key in x for key in keys)]

output_full_code = sorted(glob.glob("depyf_output/*/full_code_*.py"))
expected_full_code = sorted(glob.glob("tests/depyf_output/*/full_code_*.py"))
expected_full_code = [x[len("tests/"):] for x in expected_full_code]

output_full_code = exclude_files(output_full_code, ["insert_deferred_runtime_asserts"])
expected_full_code = exclude_files(expected_full_code, ["insert_deferred_runtime_asserts"])

msg = "Unexpected files:\n"
for x in set(output_full_code) - set(expected_full_code):
msg += x + "\n"
Expand All @@ -23,6 +29,9 @@
expected_files.sort()
expected_files = [x[len("tests/"):] for x in expected_files]

output_files = exclude_files(output_files, ["insert_deferred_runtime_asserts"])
expected_files = exclude_files(expected_files, ["insert_deferred_runtime_asserts"])

msg = f"len(output_files)={len(output_files)}, len(expected_files)={len(expected_files)}.\n"
msg += "Unexpected files:\n"
for x in set(output_files) - set(expected_files):
Expand Down

0 comments on commit 079a69d

Please sign in to comment.