[TIP] unittest.TestCase and tags
fomcl at yahoo.com
Fri Apr 18 11:57:02 PDT 2014
> From: Mateusz Łoskot <mateusz at loskot.net>
>To: testing-in-python at lists.idyll.org
>Sent: Friday, April 18, 2014 2:31 PM
>Subject: [TIP] unittest.TestCase and tags
>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.
>I found similar question has been asked in 2008 in thread
>"Tag-based execution plugin for nose?"  but the solution
>is based on extending unittest with metaclass  to enable use of nose.
>Is nose the only way to achieve such extensible tagging for unittest cases?
>Is the solution proposed above still recommended option or perhaps
>the unittest has got some related features in Python 3.2 or later?
>Any other mechanisms of tagging out there?
This seems nice, but it's not unittest.TestCase: http://nose.readthedocs.org/en/latest/plugins/attrib.html
$ nosetests -vv -p
Selects test cases to be run based on their attributes.
Run only tests that have attributes specified by ATTR [NOSE_ATTR]
Run only tests for whose attributes the Python expression EXPR
evaluates to True [NOSE_EVAL_ATTR]
More information about the testing-in-python