Today I ran a bunch of doctests using Python 2.6 on a Ubuntu 9.10 with nose :
nosetests --with-doctest
Ran 0 tests in 0.001s
OK
WTF? I had tests in that files, why didn't that work?
I changed permission to 644:
sudo chmod 644 * -R
nosetests --with-doctest
Ran 11 test in 0.004s
FAILED (errors=1)
Changing it back to 777:
sudo chmod 777 * -R
nosetests --with-doctest
Ran 0 tests in 0.001s
OK
Why is that? Using 644, I can't even edit my files!
nose, by default, follows a few simple rules for test discovery. If it looks like a test, it's a test. Names of directories, modules, classes and functions are compared against the testMatch regular expression, and those that match are considered tests. Any class that is a unittest.
Nose is a popular test automation framework in Python that extends unittest to make testing easier. The other advantages of using the Nose framework are the enablement of auto discovery of test cases and documentation collection.
Try the --exe
flag:
$ nosetests --help
...
--exe Look for tests in python modules that are executable.
Normal behavior is to exclude executable modules,
since they may not be import-safe [NOSE_INCLUDE_EXE]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With