No subject
Wed Aug 26 22:14:35 BST 2009
localization helps: only two tests needed to be updated...
revno 2463 is also a good example of inheritance and setUp().
bzrlib/tests/test_script.py:
You won't find any setup here (surprise, they are in
bt.script.py) but you'll see tests grouped in specific classes so
the only needed link is the class name.
bb.test_push.py and bb.set_send.py:
For some test examples reduced to the extreme and certainly the
ones I prefer. The test name is almost redundant with the
assertion. It's so extreme that there is certainly over-testing
here (coverage can tell us), but it demonstrate an important
point: if you put a bit of effort into the test infrastructure,
the tests themselves become trivial again and you can go back to
have fun with the application code.
Also look at revno 4486 for bb.test_send.py for a migration from
make_* and no setUp to setUp and helpers. And focus on test
readability there. Notice how some helpers were kind of lost
between tests, how the setup was duplicated all over the place,
how using helpers make the tests more readable, etc... And
finally note, that more can be done there...
I think in the end, my arguments are about making tests with less
duplicate code, more focused and more easily reused via
parametrization, all of that points towards specialized
classes. It certainly doesn't apply to any and all tests, but
many existing tests can certainly benefit from it.
Vincent
More information about the bazaar
mailing list