Merge lp:~bac/launchpad/repeats into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Gary Poster |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15329 |
Proposed branch: | lp:~bac/launchpad/repeats |
Merge into: | lp:launchpad |
Diff against target: |
159 lines (+130/-5) 2 files modified
lib/lp/services/testing/customresult.py (+10/-5) lib/lp/services/testing/tests/test_customresult.py (+120/-0) |
To merge this branch: | bzr merge lp:~bac/launchpad/repeats |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benji York (community) | code | Approve | |
Review via email: mp+107651@code.launchpad.net |
Commit message
Ensure --load-list properly runs multiple instances of the same test.
Description of the change
= Summary =
The change to ensure --load-list ran tests in the same order as
presented in the test list file incorrectly assumed that testcase ids
were unique and added them to a hash. This approach broke for the
doctests that get registered manually and run multiple times. (See
the 'special' set in lp/answers/
== Proposed fix ==
Rather than assume a 1:1 mapping between test name and the test cases
discovered by zope.testing, assume it is 1:n.
== Pre-implementation notes ==
Productive pair programming with Benji to help find the culprit.
== Implementation details ==
As above.
== Tests ==
bin/test --vv bin/test -vv lp.services.
== Demo and Q/A ==
It can be demoed on the command-line. First create a file with one
repeated testcase:
% cat testlist
lib/lp/
Then run using --load-list:
% bin/test --load-list testlist
Running lp.testing.
Set up lp.testing.
Set up lp.testing.
Set up lp.testing.
Set up lp.testing.
Ran 3 tests with 0 failures and 0 errors in 1.026 seconds.
Tearing down left over layers:
Tear down lp.testing.
Tear down lp.testing.
Tear down lp.testing.
Tear down lp.testing.
You'll note the test was run three times.
If you repeat the same exercise in trunk it'll just show one test,
which is wrong.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
./lib/lp/
31: E301 expected 1 blank line, found 0
33: E301 expected 1 blank line, found 0
35: E301 expected 1 blank line, found 0
37: E301 expected 1 blank line, found 0
I have some questions about this branch.
Why are test cases that have no layer filtered out? I would think that
we have at least a few tests that aren't in a layer (pure unit tests).
The imports for TestCase and filter_tests only need one line so they
shouldn't use multi-line imports.
FakeTestCase looks like it needs to stretch (it doesn't have any
whitespace between methods).
The TestFilterTests setUp method probably did something in an earlier
edit other than calling the super class' method of the same name, but
now that it doesn't, there's no need for it to be defined at all.
Instead of "self.assertTru e(layername in results)" you should use
assertIn, which generates slightly nicer error messages when the
assertion fails.