Is there a way to tell nose not to test a particular function foo() enclosed in a file containing other functions that need to be tested ?
def foo():
'''Was the function does.
:Example:
>>> # I don't wan't to test this code
>>> # because it uses imports
>>> # of some packages not declared as dependencies
'''
Best
You can raise SkipTest:
from nose.plugins.skip import SkipTest
def test_that_only_works_when_certain_module_is_available():
if module is not available:
raise SkipTest("Test %s is skipped" % func.__name__)
or use unittest.skip decorator:
import unittest
@unittest.skip("temporarily disabled")
class MyTestCase(unittest.TestCase):
...
alternatively, if this isn't even a test function but is incorrectly detected as test function, and you don't want the function to appear in test report as skipped test, you can mark the function with nottest decorator:
from nose.tools import nottest
@nottest
def test_but_not_really_test()
...