I have directories, which contain files named like:
test_foo.py
Each file is a test case.
I would like to
Run all the tests in a directory from the command line. I am using
unittest2
, since we are running Python 2.5.1. From one of these directories I tried typing this at the command line:python -m unittest2 discover -p 'test_*.py'
and several different variants. I get no error, but nothing happens. I was expecting all the tests within all the test cases in that directory to run and get results.
I also tried having a script in the directory where I did this:
loader = unittest2.TestLoader() t = loader.discover('.')
If I print the
t
variable, I can see my test cases, but from the documentation I can't figure out what to do with the loader object once I have it.