decred / tinydecred

Python tools for Decred
ISC License
27 stars 14 forks source link

tests: speed them up by reducing global gap limits #159

Closed teknico closed 4 years ago

teknico commented 4 years ago

This fixes #157 (or at least improves it).

Instead of monkeypatching I just reduced global gap limits. The slowest test is down to 3 from 8 seconds (and maybe it can be improved more), several other tests are faster too.

Interestingly, tests get even faster if we don't restore the global gap limits, and they still pass.

(I changed the rather obscure og prefix into orig.)

teknico commented 4 years ago

All good, but how about monkeypatch.setattr(account, "DefaultGapLimit", 2)?

That works and does away with all the restoring business, I like it. Applying it to ACCOUNT_GAP_LIMIT too.