Merge lp:~jtv/launchpad/importqueue-test-cleanup into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Robert Collins on 2010-11-03 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11839 |
| Proposed branch: | lp:~jtv/launchpad/importqueue-test-cleanup |
| Merge into: | lp:launchpad |
| Diff against target: |
56 lines (+3/-18) 1 file modified
lib/lp/translations/tests/test_translationimportqueue.py (+3/-18) |
| To merge this branch: | bzr merge lp:~jtv/launchpad/importqueue-test-cleanup |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins (community) | Approve on 2010-11-03 | ||
| Steve Kowalik (community) | code* | Approve on 2010-11-03 | |
| Launchpad code reviewers | code | 2010-11-03 | Pending |
|
Review via email:
|
|||
Commit Message
Translations test cleanup.
Description of the Change
= Translations Import Queue Test Cleanup =
This cleans up something I just found in a Translations test.
The test uses a popular and valid technique for building multiple variant of very similar test scenarios: it creates a base class containing the re-usable tests, and derives from that multiple test cases that define the different circumstances under which the same tests from the base class are to be run.
However it does this in an awkward way. The base class is derived from TestCaseWithFac
To work around that, the test defines a test_suite function (which we have otherwise more or less abolished) to define exactly which tests are to be run. As far as I can see, every test case that is added to the test will have to be added to test_suite in order for it to become part of the test suite.
There is a better pattern to deal with this particular problem. Because of Python's dynamic nature, the base class does not need to be derived from TestCase (or TestCaseWithFac
I verified manually (well, using diff) that this runs the exact same tests as before. Only the order is different. Running "wc -l" on the test output confirms this.
To test, try this before and after:
{{{
./bin/test -vv lp.translations
}}}
The output shows the same tests passing, though not necessarily in the same order.
Jeroen

Hardly worth the review :)