Add testing utilities for pre-generating temp filename and asserting diffs.

Review Request #11801 — Created Aug. 24, 2021 and submitted

Information

RBTools
master

Reviewers

In an effort to reduce the workload of some unit tests, and create a
more standardized set of testing functions, TestCase has gained two
new functions:

  1. precreate_tempfiles() will generate a specified number of temporary
    filenames (using make_tempfile()), spy on make_tempfile, and then
    return that list. The list of temp filenames are also returned to the
    caller. This allows the caller to pre-generate some command
    executions or spy operations that may need to know those temp
    filenames.

  2. assertDiffEqual(), which compares two diffs, ensuring both are
    bytestrings and comparing the lines of each to ensure correct content
    (or to make diffing of mismatches clear).

Along with this, maxDiff was set to a high number, allowing assertion
failures that compare strings or lists to provide more useful
information, rather than truncating prematurely.

kgb 6.1 is now required, in order to support the spy operation
functionality needed by precreate_tempfiles().

Successfully made use of the new functionality in some upcoming unit tests.

Summary ID
Add testing utilities for pre-generating temp filename and asserting diffs.
In an effort to reduce the workload of some unit tests, and create a more standardized set of testing functions, `TestCase` has gained two new functions: 1. `precreate_tempfiles()` will generate a specified number of temporary filenames (using `make_tempfile()`), spy on `make_tempfile`, and then return that list. The list of temp filenames are also returned to the caller. This allows the caller to pre-generate some command executions or spy operations that may need to know those temp filenames. 2. `assertDiffEqual()`, which compares two diffs, ensuring both are bytestrings and comparing the lines of each to ensure correct content (or to make difffing of mismatches clear). Along with this, `maxDiff` was set to a high number, allowing assertion failures that compare strings or lists to provide more useful information, rather than truncating prematurely. kgb 6.1 is now required, in order to support the spy operation functionality needed by `precreate_tempfiles()`.
df57e3e9f5318cb423f86adb0900935729467741
Description From Last Updated

Typo in description: difffing

daviddavid

F841 local variable 'tmpfiles' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. 
      
  2. Show all issues

    Typo in description: difffing

  3. 
      
chipx86
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (948e581)