Add a standard testing function for normalizing diff results.
Review Request #12572 — Created Aug. 24, 2022 and submitted
We've been developing a pattern in recent changes to normalize the
results of aSCMClient.diff()
operation for comparison in unit tests,
changing timestamps into something stable. Both the Perforce and Bazaar
support have implemented their own version of this_normalize_diff()
function. Upcoming changes for CVS need this as well, but with a
different timestamp format.This introduces
SCMClientTestCase.normalize_diff_result()
, which now
handles the normalization but accepts variations in the timestamp
format. It takes an optionaldate_format=
argument containing values
that would be passed tostrftime()
, and turns (some) flags into
patterns for a regex used to transform dates.Bazaar and Perforce tests have been updated to use this.
Unit tests pass on Python 3.7-3.11.
Summary | ID |
---|---|
6085b3450403754a2ac5737bc3d54c2cb85d040e |