This page is autogenerated. Please add comments only beneath the horizontal rule at the bottom of the page. Changes above that line will be lost when the page is regenerated.
Features
Run as collect
nose begins running tests as soon as the first test module is loaded, it does not wait to collect all tests before running the first.
Output capture
Unless called with the -s (--nocapture) switch, nose will capture stdout during each test run, and print the captured output only for tests that fail or have errors. The captured output is printed immediately following the error or failure output for the test. (Note that output in teardown methods is captured, but can't be output with failing tests, because teardown has not yet run at the time of the failure.)
Assert introspection
When run with the -d (--detailed-errors) switch, nose will try to output additional information about the assert expression that failed with each failing test. Currently, this means that names in the assert expression will be expanded into any values found for them in the locals or globals in the frame in which the expression executed.
In other words if you have a test like:
def test_integers():
a = 2
assert a == 4, "assert 2 is 4"
You will get output like:
File "/path/to/file.py", line XX, in test_integers:
assert a == 4, "assert 2 is 4"
AssertionError: assert 2 is 4
>> assert 2 == 4, "assert 2 is 4"
Setuptools integration
nose may be used with the setuptools test command. Simply specify nose.collector as the test suite in your setup file:
setup (
# ...
test_suite = 'nose.collector'
)
Then to find and run tests, you can run:
python setup.py test
When running under setuptools, you can configure nose settings via the environment variables detailed in the nosetests script usage message.
Please note that when run under the setuptools test command, some plugins will not be available, including the builtin coverage, profiler, and missed test plugins.
nose also includes its own setuptools command, nosetests, that provides support for all plugins and command line options, as well as configuration using the setup.cfg file. See nose.commands for more information about the nosetests command.
