[apparmor] [patch] enable testloops for nosetests

Steve Beattie steve at nxnw.org
Wed Apr 22 19:12:08 UTC 2015


On Thu, Apr 02, 2015 at 11:19:29PM +0200, Christian Boltz wrote:
> Hello,
> 
> this patch ensures nosetests sees all tests in the tests[] tuples. This 
> requires some name changes because nosetests thinks all function names 
> containing "test" are tests. (A "not a test" docorator would be an 
> alternative, but that would require some try/except magic to avoid a 
> dependency on nose.)
> 
> To avoid nosetests thinks the functions are a test,
> - rename setup_all_tests() to setup_all_loops()
> - rename regex_test() to _regex_test() (in test-regex_matches.py)
> 
> Also add the module_name as parameter to setup_all_loops and always run
> it (not only if __name__ == '__main__').
> 
> Known issue: nosetests errors out with
>     ValueError: no such test method in <class ...>: stub_test
> when trying to run a single test generated out of tests[].
> (debugging hint: stub_test is the name used in setup_test_loop().)
> But that's still an improvement over not seeing those tests at all ;-)
> 
> Again, I propose this patch for trunk and 2.9.
> 
> [ 31-enable-testloops-for-nosetests.diff ]

I'm not crazy about needing to be extra careful about our test method
names, but I can see why you went with this approach.

Acked-by: Steve Beattie <steve at nxnw.org> for trunk and 2.9.

Thanks.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150422/39b08d52/attachment.pgp>


More information about the AppArmor mailing list