Search code examples
pythonunit-testingpython-unittestnose

Can I put nosetests command-line options in a configuration file?


I'd like to put the command-line options I prefer for nosetests into a file, so they'll travel with my repo. The docs are unclear, at best, or maybe just wrong, about how this can be done.

nose's documentation mentions a ".noserc or nose.cfg file" but when I added the following to either of them, nothing changes-

[nosetests]
nocapture=1
verbosity=3

These are the equivalent of nosetests -vvv --nocapture.


Solution

  • setup.cfg is a third filename that nosetests recognizes as a source for project-level command-line options. nosetests looks in the current folder for setup.cfg, and .noserc or nose.cfg in your home directory.

    The docs ".noserc or nose.cfg" in the first paragraph, but doesn't mention setup.cfg until deeper in the page.