I wrote a nosetest class to test a particular method - test_method()
WHen I run this module I noticed nosetests ran the other methods as we well - create_test_private_method.
I thought nosetests will test only methods that starts with test_.
import unittest
class test(unittest.TestCase):
def create_test_private_method(self):
self.assertEqual(1,1)
def test_method(self):
self.assertEqual(2,2)
Output:
create_test_private_method (nosetest.test) ... ok
test_method (nosetest.test) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.009s
OK
From nosetests docs:
Any python source file, directory or package that matches the testMatch regular expression (by default: (?:^|[b_.-])[Tt]est) will be collected as a test (or source for collection of tests).
To avoid such a behavior you can
nose.tools.nottest
decorator (as Oleksiy pointed out)