[MERGE] Automatic discovery of tests
Robert Collins
robertc at robertcollins.net
Tue Nov 13 22:07:48 GMT 2007
On Tue, 2007-11-13 at 15:51 -0600, John Arbash Meinel wrote:
>
> However, there is also the convenience factor. Having to add an extra
> line is a
> bit of inconvenience. It may not be huge now that the bzr test suite
> is fairly
> stable. But I know that this sort of thing is very useful when writing
> a
> plugin, and adding 10+ new test_* files.
I will happily ok a merge of a convenience function like
def find_child_module_names(parent_name):
"""Find child modules of parent_name.
This scans the disk looking for files that look like python modules
- .so, .py, .pyc etc. These are then reduced so that there is only
one module returned (we return foo even if we see foo.so and
foo.py).
__init__ is not returned.
:return: A list of absolute module names.
"""
Then you could do in your plugin:
test_mod_names = \
find_child_module_names('bzrlib.plugins.pluginname.tests')
I think we may have a use for this outside the test suite (plugin
scanning anyone?)
It's possible to even write a zip aware version of this in future.
And we can discuss further whether changing the core to use this is a
good idea or not.
-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/20071114/b077e1d7/attachment.pgp
More information about the bazaar
mailing list