There is only one truth. It is the source.

Nose notes

December 20, 2012

Tags: django, nose, testing

Nose is licensed under LGPL. django-nose is licensed under BSD.

Directories and modules containing tests must have the word "test" in their name. More correctly Nose looks for names of classes and methods that match the testMatch regular expression which by default is (?:^|[\\b_\\.-])[Tt]est). Other than that there is no other work to do to make tests discoverable. No manual creation of test suites is required.

Tests can be run by pointing to files or Python modules. The test case is separated from the file or module name with a colon.

Examples

bin/manage test component_catalog/tests/functional_tests.py
bin/manage test organization.tests:CreatedByListFilterTestCase
bin/manage test organization.tests:CreatedByListFilterTestCase.test_lookups

Arguments to Nose can be passed using the Django setting NOSE_ARGS. I have set this to ['--detailed-errors', '--with-id']. The first argument makes Nose print more debugging information for a test failure. The second argument makes Nose write a file called .noseids that records which tests were run and which failed. Rerunning only failed tests can be done by passing the --failed argument along with --with-id. I configured SVN to ignore .noseids.

See

Nose can be configured to drop into a dubugger. pdb, ipdb, and pudb are supported (the last 2 require plugins).

See