[RFC/MERGE](0.17) Auto load tests
John Arbash Meinel
john at arbash-meinel.com
Mon Apr 30 15:21:03 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> On Fri, 2007-04-27 at 18:08 -0500, John Arbash Meinel wrote:
>> Mostly I'm looking for feedback. I wanted to implement this for a
>> plugin
>> I was writing, because I was getting tired of manually tracking
>> filenames. (Also with plugins you have to be careful about your python
>> path, because you are actually loaded as bzrlib.plugins.PLUGIN.tests
>> not
>> PLUGIN.tests).
>
> I'm personally not a fan of autodiscovery of tests - it just feels like
> too much magic. If we are going to do it I'd rather we looked at
> leveraging nose or trial than rolling our own. -0 from me.
>
> -Rob
Well, we already have TestCase's auto discovered. It seems natural that
the files they are in would also be.
The big use case for me, was handling a large test suite in a plugin. I
really don't like having to do "from bzrlib.plugins.myplugin.tests
import ..."
Or using:
tests = [
'bzrlib.plugins.myplugin.tests.test_foo',
]
For one, I'm not sure if the main library I'm playing with is going to
stay a bzr plugin.
Having auto-discovery means that my test suite doesn't need to know
where it is located.
I realize I could do something like:
tests = [
'test_bar',
'test_foo',
]
tests = [__name__ + '.' + test for test in tests]
Which is at least more tasteful than prefixing everything.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGNftPJdeBCYSNAAMRAn5EAKCDpsfnTfajuAJ5Lt74p+ELjPhaZACgoJyH
nKwl2s8MefkF/1D3Nlqm/3Q=
=xnop
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list