• 
      

    Add a standard testing function for normalizing diff results.

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

    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.

    Summary ID
    Add a standard testing function for normalizing diff results.
    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.
    6085b3450403754a2ac5737bc3d54c2cb85d040e
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.x (91c11d1)