Add a standard testing function for normalizing diff results.

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

chipx86
RBTools
release-4.x
12571
rbtools

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.

Summary
Add a standard testing function for normalizing diff results.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.x (91c11d1)
Loading...