Add a standard testing function for normalizing diff results.

Review Request #12572 — Created Aug. 24, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-4.x

Reviewers

We've been developing a pattern in recent changes to normalize the
results of a SCMClient.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 optional date_format= argument containing values
that would be passed to strftime(), 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.

Commits

Files