[MERGE][bug #125784] Don't suppress original errors when .unlock() fails
Robert Collins
robertc at robertcollins.net
Tue Jun 17 01:22:53 BST 2008
On Mon, 2008-06-16 at 11:14 -0500, John Arbash Meinel wrote:
>
> It is quite a bit more effort to multiply rather than subclass.
> Because the
> multiplier is designed for adapting all tests in a module, so adapting
> just 1
> class XX is kind of hard. 'load_tests' would let you do it, but you
> have to
> 'iter_suite_tests(basic_tests)' and then figure out which ones need to
> be adapted.
>
> Or have them in a separate module, and adapt everything, etc.
>
> I'm not saying I wouldn't do it if pushed, just that in this case it
> would be a
> lot more effort.
Uhm:
def load_tests(standard_tests, module, loader):
"""Parameterize the test for tempfile creation with different
encodings."""
to_adapt, result = split_suite_by_re(standard_tests,
"test__create_temp_file_with_commit_template_in_unicode_dir")
for test in iter_suite_tests(to_adapt):
result.addTests(EncodingTestAdapter().adapt(test))
return result
Thats an example of multiplying a *single* test in a test class.
I don't think it really gets much simpler - I consider this an example
of well done adaption (except that the scenario and adapter are mixed
here - but the rest is about ideal).
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080617/88254f0e/attachment.pgp
More information about the bazaar
mailing list