Speed up the unit test for mail header max lengths.
Review Request #9192 — Created Sept. 12, 2017 and submitted
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 ofrange()
for the loop.
Unit tests pass.
Verified that behavior does change if going below the 65 file threshold.