Question

I have written a unit test in python and would like to have it picked up when I run nose. It works fine when I run nose on the file containing the test, i.e.

nosetests myFile.py

but not when I just run

nosetests

in the same directory. I thought nose would automatically pick up all tests in the directory where you are running it? Any idea how I can make it work? There are more tests in various files in that directory and I would like to be able to run them at the same time.

This is what my test looks like:

class testSimple(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def testStupid(self):
        self.Assert(False)
Was it helpful?

Solution

Your test cases python file name should begin with "test" so nose can pick it up.

It is possible to use nose without keeping such naming convetion if you like - required configuration is described in this thread:

How to make py.test or nose to look for tests inside all python files?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top