Speed up the unit test for mail header max lengths.

Review Request #9192 - Created Sept. 12, 2017 and submitted

Christian Hammond
Review Board
release-2.5.x
258d52b...
reviewboard

The unit test for checking behavior when reaching a large number of
diff-related mail headers was easily the slowest test in our suite,
taking around 10 seconds on my computer. This was too long, and it turns
out unnecessarily long for the test.

This makes a few changes to this test to reduce it to just over 2
seconds (again, on this computer). First, we no longer generate 400
entries, which is way too many, as the threshold is really 65 files. We
now generate 70, just to cover that.

The FileDiffs aren't saved one-at-a-time anymore. We now create them
and then bulk-insert them, shaving off a little bit of time.

We also now use xrange() instead of range() for the loop.

Unit tests pass.

Verified that behavior does change if going below the 65 file threshold.

David Trowbridge
  1. Ship It!
  2. 
      
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (af5ce81)
Loading...