Is there a way to skip whole TestCase
based on custom condition using nosetests? I mean something in unittest.skip*
style.
I tried
import unittest
@unittest.skip("No reason")
class TestFoo(object):
def test_foo(self):
assert False
I found out this works using python <= 2.7.3 (apparently by accident), but in python 2.7.6 not.
Is there a nosetests way to do this, or I have to create my own decorator?
Notes:
- We tried all combinations of python 2.7.3, 2.7.6 and nosetests 1.1.2, 1.3.0.
- If the class is inherited from
unittest.TestCase
it works, but that is not what I need. - It seems to work when
setUpClass
raisesSkipTest
, but it looks clumsy. - I found
nottest
decorator, but it does not mark test as skipped.
Summary
- Update 20. 5. 2014: To this date I haven't found any solution to this problem, so it seems the only option is to write custom decorator.
- Update 12. 6. 2014: I have found that raising
SkipTest
insetUpClass
is not a good idea in some cases since nosetests doesn'tteardownContext
in those cases. This may have adverse effects if plugins are involved.