[TIP] unittest.TestCase and tags

Mateusz Łoskot mateusz at loskot.net
Fri Apr 18 15:33:30 PDT 2014


n 18 April 2014 21:12, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
>>
>> I have a collection of integration tests based on the unittest package.
>> I'd like to be able to categorise tests, so I can select what kind of tests
>> I want to run. For example, tests reaching local filesystem,
>> tests relying on remote database servers, and so on.
>
> from nose.plugins.attrib import attr
> import unittest
>
> class Test(unittest.TestCase):
>     @attr('database')
>     def test_blah(self):
>         self.assertTrue(True)
>
> then select the attribute:
>
> $ nosetests -a database
>
>
> Thanks, didn't know about this ;-)

I thank you Sir! :)

I go nose, loving it.

Best regards,
-- 
Mateusz  Łoskot, http://mateusz.loskot.net



More information about the testing-in-python mailing list