pytest
pytest copied to clipboard
Truncate diff of very long texts if not in verbose mode (fix #12406)
The _diff_text_ function might try to calculate diffs of huge texts, taking a very long time, even if that diff is going to be truncated in non-verbose mode. This PR adds truncation of the texts before calculating the diff in that case. New tests added, old tests pass.
I'm not sure the code is correct for when equal trailing characters aren't skipped.
Happy to address any reviews or suggestions.
Closes #12406.
The logic for when equal leading characters aren't skipped is now sound.