Disabling Python nosetests Disabling Python nosetests python python

Disabling Python nosetests


Nose already has a builtin decorator for this:

from nose.tools import nottest@nottestdef test_my_sample_test()    #code here ...

Also check out the other goodies that nose provides: https://nose.readthedocs.org/en/latest/testing_tools.html


You can also use unittest.skip decorator:

import unittest@unittest.skip("temporarily disabled")class MyTestCase(unittest.TestCase):    ...


There also is a skiptest plugin for nosetest, which will cause the test show in test output as skipped. Here is a decorator for that:

def skipped(func):    from nose.plugins.skip import SkipTest    def _():        raise SkipTest("Test %s is skipped" % func.__name__)    _.__name__ = func.__name__    return _

Example output:

$ nosetests tests............................................................................................................S.............----------------------------------------------------------------------Ran 122 tests in 2.160sOK (SKIP=1)