pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Truncate diff of very long texts if not in verbose mode (fix #12406)

Open devdanzin opened this issue 1 year ago • 1 comments

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.

devdanzin avatar Jul 20 '24 13:07 devdanzin

The logic for when equal leading characters aren't skipped is now sound.

devdanzin avatar Jul 22 '24 16:07 devdanzin