[MERGE][bug #125784] Don't suppress original errors when .unlock() fails
John Arbash Meinel
john at arbash-meinel.com
Tue Jun 17 14:32:15 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
| 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
That doesn't address writing the adapter, and all of the helper code involved in
that. (You have "EncodingTestAdapter" secretly brought into the situation.)
I'm willing to do it, but it isn't close to the ease of subclassing.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhXvN8ACgkQJdeBCYSNAAMTOwCeLb3UmNaDJIgFK4/JLmP9gAw3
1QIAn2A6rhamXTMQ0AcL1BJCYHHJ6IKv
=Ky16
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list