Skip to content

Commit

Permalink
Make "file with difference" message clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
Tina-otoge committed Apr 27, 2024
1 parent b7361a1 commit b7ac4bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
examples = root.glob("examples/*/")


def check_diffs(diff):
def check_diffs(diff, example):
assert diff.left_only == []
assert diff.right_only == []
success = True
for filename in diff.diff_files:
success = False
print(f"File with difference: {filename}")
print(f"File with difference: {example / filename}")
left_content = (
(Path(diff.left) / filename).read_text().splitlines(keepends=True)
)
Expand All @@ -29,7 +29,7 @@ def check_diffs(diff):
print()

for sub_dcmp in diff.subdirs.values():
success = check_diffs(sub_dcmp) and success
success = check_diffs(sub_dcmp, example) and success
return success


Expand All @@ -51,5 +51,6 @@ def test_examples(example, tmpdir, request):
diff = filecmp.dircmp(expected_output, outdir)
print(expected_output, outdir)
assert check_diffs(
diff
diff,
example,
), "Some files differ. See above using the -s flag of pytest"

0 comments on commit b7ac4bb

Please sign in to comment.