Merge lp:~frankban/launchpad/tests-randomization into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2012-06-07 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15380 |
| Proposed branch: | lp:~frankban/launchpad/tests-randomization |
| Merge into: | lp:launchpad |
| Diff against target: |
119 lines (+37/-14) 3 files modified
buildout-templates/bin/test.in (+1/-1) lib/lp/services/testing/customresult.py (+11/-1) lib/lp/services/testing/tests/test_customresult.py (+25/-12) |
| To merge this branch: | bzr merge lp:~frankban/launchpad/tests-randomization |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Graham Binns (community) | code | 2012-06-07 | Approve on 2012-06-07 |
|
Review via email:
|
|||
Commit Message
Fixed the way test cases in --load-list are randomized: now -t and --load-list produce the same random order, given the same shuffle seed.
Description of the Change
= Summary =
bin/test --shuffle --shuffle-seed [seed] can be used to reproduce the same random ordering of test cases in multiple calls. However, this ordering changes if you use --load-list rather than -t.
== Proposed fix ==
--load-list, if shuffle is requested, should generate the initial list of test cases to be shuffled ordering them by id.
== Implementation details ==
The added optional argument `reorder_tests` of lp.services.
bin/test now calls `filter_tests` passing reorder_tests=True if --shuffle is used.
== Tests ==
bin/test -cvvt lp.services.
== Demo and Q/A ==
1. Save a file mytests with this content:
lp.soyuz.
lp.bugs.
lp.scripts.
lp.bugs.
2. check --load-list still preserves test cases ordering:
$ bin/test -cvv --load-list mytests
...
Running:
lp.soyuz.
lp.bugs.
lp.scripts.
lp.bugs.
Ran 4 tests with 0 failures and 0 errors in 4.595 seconds.
...
3. shuffle tests, and copy the used seed:
$ bin/test -cvv --load-list mytests --shuffle
...
Running:
lp.scripts.
lp.bugs.
lp.bugs.
lp.soyuz.
Ran 4 tests with 0 failures and 0 errors in 4.520 seconds.
...
Tests were shuffled using seed number 342800994878.
4. Run the same tests using -t and the same shuffle seed:
$ bin/test -cvv -t lp.soyuz.
The test ordering should be the same as the previous call.
NO QA
== lint ==
Linting changed files:
buildout-
lib/lp/
lib/lp/
| Francesco Banconi (frankban) wrote : | # |

Thanks Graham.