mozilla/zamboni — pull request #543 by cvan (2012-12-24 18:46:48+00:00)
Title: introducing BroFactory, AddonFactory, and AppFactory

let's you create `Addon` objects (unsaved or saved) with some nice defaults. this is an improvement to the previous `addon_factory` which did 4 saves. and it speeds up tests a tad:

(z)(Chris-MacBook-Pro.local) %% python /opt/speed.py factories "webapps search" /opt/zamboni (factories)Benchmarks for webapps search:
After (factories):
Dropping database ...
Trial 1:
Ran 181 tests in 33.986s
Dropping database ...
Trial 2:
Ran 181 tests in 31.541s
Dropping database ...
Trial 3:
Ran 181 tests in 31.702s
Dropping database ...
Trial 4:
Ran 181 tests in 31.457s
Dropping database ...
Trial 5:
Ran 181 tests in 31.730s
Total duration: 160.4160s
Average time per trial: 32.0832s
Before (master):
Dropping database ...
Trial 1:
Ran 181 tests in 41.873s
Dropping database ...
Trial 2:
Ran 181 tests in 43.294s
Dropping database ...
Trial 3:
Ran 181 tests in 39.206s
Dropping database ...
Trial 4:
Ran 181 tests in 35.471s
Dropping database ...
Trial 5:
Ran 181 tests in 35.499s
Total duration: 195.3430s
Average time per trial: 39.0686s
Before (195.3430 / 5) vs. After (160.4160 / 5) => 6.9854s faster (1.2177x speedup)