Skip to content

Commit

Permalink
Use sets here to show full diffs in functional tests
Browse files Browse the repository at this point in the history
Co-authored-by: Ethan Leba <[email protected]>
  • Loading branch information
Pierre-Sassoulas and ethan-leba committed Sep 7, 2020
1 parent e18f51c commit 4fe3ff4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pylint/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,15 @@ def _split_lines(cls, expected_messages, lines):

def _check_output_text(self, expected_messages, expected_lines, received_lines):
expected_lines = self._split_lines(expected_messages, expected_lines)[0]
for expected, received in zip(expected_lines, received_lines):
assert (
expected == received
), f"In '{self._test_file.base}' first unmatched lines: {expected} != {received}"
missing = set(expected_lines) - set(received_lines)
unexpected = set(received_lines) - set(expected_lines)
error_msg = f"'{self._test_file.base}':\n"
if missing:
error_msg += "- Missing lines:\n{str_missing}"
for line in missing:
error_msg += f"{line}\n"
if unexpected:
error_msg += "- Unexpected lines:\n"
for line in unexpected:
error_msg += f"{line}\n"
assert expected_lines == received_lines, error_msg

0 comments on commit 4fe3ff4

Please sign in to comment.