Skip to content

Commit 15f61c0

Browse files
committed
test: Display difference in mismatched e2e files.
1 parent f21dda0 commit 15f61c0

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: poetry run mypy --show-error-codes openapi_python_client
5252

5353
- name: Run pytest
54-
run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests
54+
run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py
5555

5656
- name: Generate coverage report
5757
shell: bash

end_to_end_tests/test_end_to_end.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,17 @@ def _compare_directories(
3636
_, mismatches, errors = cmpfiles(record, test_subject, dc.common_files, shallow=False)
3737
mismatches = set(mismatches)
3838

39-
expected_path_mismatches = []
4039
for file_name in mismatches:
4140
mismatch_file_path = test_subject.joinpath(file_name)
42-
expected_content = expected_differences.get(mismatch_file_path)
43-
if expected_content is None:
44-
continue
41+
42+
if mismatch_file_path in expected_differences:
43+
expected_content = expected_differences[mismatch_file_path]
44+
del expected_differences[mismatch_file_path]
45+
else:
46+
expected_content = (record / file_name).read_text()
4547

4648
generated_content = (test_subject / file_name).read_text()
4749
assert generated_content == expected_content, f"Unexpected output in {mismatch_file_path}"
48-
expected_path_mismatches.append(mismatch_file_path)
49-
50-
for path_mismatch in expected_path_mismatches:
51-
matched_file_name = path_mismatch.name
52-
mismatches.remove(matched_file_name)
53-
del expected_differences[path_mismatch]
54-
55-
if mismatches:
56-
pytest.fail(
57-
f"{first_printable} and {second_printable} had differing files: {mismatches}, and errors {errors}",
58-
pytrace=False,
59-
)
6050

6151
for sub_path in dc.common_dirs:
6252
_compare_directories(

0 commit comments

Comments
 (0)