[TIP] mark tests

Ned Batchelder ned at nedbatchelder.com
Thu Jul 12 11:08:22 PDT 2012


Nose also provides for selecting tests based on attributes you assign 
with decorators.  Then you can use the attributes in expressions on the 
command line to, for example, run all the "linux" tests that aren't 
"slow", or whatever.

http://nose.readthedocs.org/en/latest/plugins/attrib.html

--Ned.

On 7/12/2012 12:08 PM, andrea crotti wrote:
> I'm writing a very complicated system that has to interact with
> databases, filesystems and perforce.
>
> I have a mock database using an in memory sqlite, and I'm studying some
> other ways to manage the filesystem, but I also have some tests that use
> the real db and real filesystem.
>
> Now I would like to have a way to mark them, for example I might want to
> run certain things only on Linux, other only on Windows, maybe on Linux
> I want to use the real database, on Windows the fake one..
>
> What might be a good way to achieve this (I use nosetest + mock + coverage)?
>
> Subclassing unittest.TestCase?
> Or maybe using decorators?
> Any other ideas?
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>





More information about the testing-in-python mailing list