1 .TH nosetests 1 "2009-04-23" "0.11" "User Commands"
3 nosetests \- nicer testing for python
4 .\" Man page generated from reStructeredText.
11 nosetests [options] [names]
17 nose collects tests automatically from python source files,
18 directories and packages found in its working directory (which
19 defaults to the current working directory). Any python source file,
20 directory or package that matches the testMatch regular expression
21 (by default: \fI(?:^|[b_.\-])[Tt]est)\fP will be collected as a test (or
22 source for collection of tests). In addition, all other packages
23 found in the working directory will be examined for python source files
24 or directories that match testMatch. Package discovery descends all
25 the way down the tree, so package.tests and package.sub.tests and
26 package.sub.sub2.tests will all be collected.
28 Within a test directory or package, any python source file matching
29 testMatch will be examined for test cases. Within a test module,
30 functions and classes whose names match testMatch and TestCase
31 subclasses with any name will be loaded and executed as tests. Tests
32 may use the assert keyword or raise AssertionErrors to indicate test
33 failure. TestCase subclasses may do the same or use the various
34 TestCase methods available.
38 To specify which tests to run, pass test names on the command line:
42 nosetests only_test_this.py
44 Test names specified may be file or module names, and may optionally
45 indicate the test case to run by separating the module or file name
46 from the test case name with a colon. Filenames may be relative or
52 nosetests another.test:TestCase.test_method
53 nosetests a.test:TestCase
54 nosetests /path/to/test/file.py:test_function
56 You may also change the working directory where nose looks for tests
57 by using the \-w switch:
61 nosetests \-w /path/to/tests
63 Note, however, that support for multiple \-w arguments is now deprecated
64 and will be removed in a future release. As of nose 0.10, you can get
65 the same behavior by specifying the target directories \fIwithout\fP
70 nosetests /path/to/tests /another/path/to/tests
72 Further customization of test selection and loading is possible
73 through the use of plugins.
75 Test result output is identical to that of unittest, except for
76 the additional features (error classes, and plugin\-supplied
77 features such as output capture and assert introspection) detailed
82 In addition to passing command\-line options, you may also put
83 configuration options in your project\'s \fIsetup.cfg\fP file, or a .noserc
84 or nose.cfg file in your home directory. In any of these standard
85 .ini\-style config files, you put your nosetests configuration in a
86 \fB[nosetests]\fP section. Options are the same as on the command line,
87 with the \-\- prefix removed. For options that are simple switches, you
96 All configuration files that are found will be loaded and their
97 options combined. You can override the standard config file loading
98 with the \fB\-c\fP option.
102 There are numerous nose plugins available via easy_install and
103 elsewhere. To use a plugin, just install it. The plugin will add
104 command line options to nosetests. To verify that the plugin is installed,
109 nosetests \-\-plugins
111 You can add \-v or \-vv to that command to show more information
114 If you are running nose.main() or nose.run() from a script, you
115 can specify a list of plugins to use by passing a list of plugins
116 with the plugins keyword argument.
120 nose 1.0 can use SOME plugins that were written for nose 0.9. The
121 default plugin manager inserts a compatibility wrapper around 0.9
122 plugins that adapts the changed plugin api calls. However, plugins
123 that access nose internals are likely to fail, especially if they
124 attempt to access test case or test suite classes. For example,
125 plugins that try to determine if a test passed to startTest is an
126 individual test or a suite will fail, partly because suites are no
127 longer passed to startTest and partly because it\'s likely that the
128 plugin is trying to find out if the test is an instance of a class
129 that no longer exists.
132 .SS 0.10 and 0.11 plugins
133 All plugins written for nose 0.10 and 0.11 should work with nose 1.0.
139 \fB\-V\fR\fR\fR, \fB\-\-version\fR\fR
140 Output nose version and exit
144 \fB\-p\fR\fR\fR, \fB\-\-plugins\fR\fR
145 Output list of available plugins and exit. Combine with higher verbosity for greater detail
149 \fB\-v\fR\fR=DEFAULT\fR, \fB\-\-verbose\fR\fR=DEFAULT
150 Be more verbose. [NOSE_VERBOSE]
154 \fB\-\-verbosity\fR\fR=VERBOSITY
155 Set verbosity; \-\-verbosity=2 is the same as \-v
159 \fB\-q\fR\fR=DEFAULT\fR, \fB\-\-quiet\fR\fR=DEFAULT
164 \fB\-c\fR\fR=FILES\fR, \fB\-\-config\fR\fR=FILES
165 Load configuration from config file(s). May be specified multiple times; in that case, all config files will be loaded and combined
169 \fB\-w\fR\fR=WHERE\fR, \fB\-\-where\fR\fR=WHERE
170 Look for tests in this directory. May be specified multiple times. The first directory passed will be used as the working directory, in place of the current working directory, which is the default. Others will be added to the list of tests to execute. [NOSE_WHERE]
174 \fB\-\-py3where\fR\fR=PY3WHERE
175 Look for tests in this directory under Python 3.x. Functions the same as \'where\', but only applies if running under Python 3.x or above. Note that, if present under 3.x, this option completely replaces any directories specified with \'where\', so the \'where\' option becomes ineffective. [NOSE_PY3WHERE]
179 \fB\-m\fR\fR=REGEX\fR, \fB\-\-match\fR\fR=REGEX\fR, \fB\-\-testmatch\fR\fR=REGEX
180 Files, directories, function names, and class names that match this regular expression are considered tests. Default: (?:^|[b_./\-])[Tt]est [NOSE_TESTMATCH]
184 \fB\-\-tests\fR\fR=NAMES
185 Run these tests (comma\-separated list). This argument is useful mainly from configuration files; on the command line, just pass the tests to run as additional arguments with no switch.
189 \fB\-l\fR\fR=DEFAULT\fR, \fB\-\-debug\fR\fR=DEFAULT
190 Activate debug logging for one or more systems. Available debug loggers: nose, nose.importer, nose.inspector, nose.plugins, nose.result and nose.selector. Separate multiple names with a comma.
194 \fB\-\-debug\-log\fR\fR=FILE
195 Log debug messages to this file (default: sys.stderr)
199 \fB\-\-logging\-config\fR\fR=FILE\fR, \fB\-\-log\-config\fR\fR=FILE
200 Load logging config from this file \-\- bypasses all other logging config settings.
204 \fB\-I\fR\fR=REGEX\fR, \fB\-\-ignore\-files\fR\fR=REGEX
205 Completely ignore any file that matches this regular expression. Takes precedence over any other settings or plugins. Specifying this option will replace the default setting. Specify this option multiple times to add more regular expressions [NOSE_IGNORE_FILES]
209 \fB\-e\fR\fR=REGEX\fR, \fB\-\-exclude\fR\fR=REGEX
210 Don\'t run tests that match regular expression [NOSE_EXCLUDE]
214 \fB\-i\fR\fR=REGEX\fR, \fB\-\-include\fR\fR=REGEX
215 This regular expression will be applied to files, directories, function names, and class names for a chance to include additional tests that do not match TESTMATCH. Specify this option multiple times to add more regular expressions [NOSE_INCLUDE]
219 \fB\-x\fR\fR\fR, \fB\-\-stop\fR\fR
220 Stop running tests after the first error or failure
224 \fB\-P\fR\fR\fR, \fB\-\-no\-path\-adjustment\fR\fR
225 Don\'t make any changes to sys.path when loading tests [NOSE_NOPATH]
230 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]
235 DO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)
239 \fB\-\-traverse\-namespace\fR\fR
240 Traverse through all path entries of a namespace package
244 \fB\-\-first\-package\-wins\fR\fR\fR, \fB\-\-first\-pkg\-wins\fR\fR\fR, \fB\-\-1st\-pkg\-wins\fR\fR
245 nose\'s importer will normally evict a package from sys.modules if it sees a package with the same name in a different location. Set this option to disable that behavior.
249 \fB\-a\fR\fR=ATTR\fR, \fB\-\-attr\fR\fR=ATTR
250 Run only tests that have attributes specified by ATTR [NOSE_ATTR]
254 \fB\-A\fR\fR=EXPR\fR, \fB\-\-eval\-attr\fR\fR=EXPR
255 Run only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR]
259 \fB\-s\fR\fR\fR, \fB\-\-nocapture\fR\fR
260 Don\'t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]
264 \fB\-\-nologcapture\fR\fR
265 Disable logging capture plugin. Logging configurtion will be left intact. [NOSE_NOLOGCAPTURE]
269 \fB\-\-logging\-format\fR\fR=FORMAT
270 Specify custom format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGFORMAT]
274 \fB\-\-logging\-datefmt\fR\fR=FORMAT
275 Specify custom date/time format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGDATEFMT]
279 \fB\-\-logging\-filter\fR\fR=FILTER
280 Specify which statements to filter in/out. By default, everything is captured. If the output is too verbose,
281 use this option to filter out needless output.
282 Example: filter=foo will capture statements issued ONLY to
283 foo or foo.what.ever.sub but not foobar or other logger.
284 Specify multiple loggers with comma: filter=foo,bar,baz.
285 If any logger name is prefixed with a minus, eg filter=\-foo,
286 it will be excluded rather than included. Default: exclude logging messages from nose itself (\-nose). [NOSE_LOGFILTER]
290 \fB\-\-logging\-clear\-handlers\fR\fR
291 Clear all other logging handlers
295 \fB\-\-with\-coverage\fR\fR
296 Enable plugin Coverage:
297 Activate a coverage report using Ned Batchelder\'s coverage module.
302 \fB\-\-cover\-package\fR\fR=PACKAGE
303 Restrict coverage output to selected packages [NOSE_COVER_PACKAGE]
307 \fB\-\-cover\-erase\fR\fR
308 Erase previously collected coverage statistics before run
312 \fB\-\-cover\-tests\fR\fR
313 Include test modules in coverage report [NOSE_COVER_TESTS]
317 \fB\-\-cover\-inclusive\fR\fR
318 Include all python files under working directory in coverage report. Useful for discovering holes in test coverage if not all files are imported by the test suite. [NOSE_COVER_INCLUSIVE]
322 \fB\-\-cover\-html\fR\fR
323 Produce HTML coverage information
327 \fB\-\-cover\-html\-dir\fR\fR=DIR
328 Produce HTML coverage information in dir
332 \fB\-\-cover\-branches\fR\fR
333 Include branch coverage in coverage report [NOSE_COVER_BRANCHES]
337 \fB\-\-cover\-xml\fR\fR
338 Produce XML coverage information
342 \fB\-\-cover\-xml\-file\fR\fR=FILE
343 Produce XML coverage information in file
348 Drop into debugger on errors
352 \fB\-\-pdb\-failures\fR\fR
353 Drop into debugger on failures
357 \fB\-\-no\-deprecated\fR\fR
358 Disable special handling of DeprecatedTest exceptions.
362 \fB\-\-with\-doctest\fR\fR
363 Enable plugin Doctest:
364 Activate doctest plugin to find and run doctests in non\-test modules.
369 \fB\-\-doctest\-tests\fR\fR
370 Also look for doctests in test modules. Note that classes, methods and functions should have either doctests or non\-doctest tests, not both. [NOSE_DOCTEST_TESTS]
374 \fB\-\-doctest\-extension\fR\fR=EXT
375 Also look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]
379 \fB\-\-doctest\-result\-variable\fR\fR=VAR
380 Change the variable name set to the result of the last interpreter command from the default \'_\'. Can be used to avoid conflicts with the _() function used for text translation. [NOSE_DOCTEST_RESULT_VAR]
384 \fB\-\-doctest\-fixtures\fR\fR=SUFFIX
385 Find fixtures for a doctest file in module with this name appended to the base name of the doctest file
389 \fB\-\-with\-isolation\fR\fR
390 Enable plugin IsolationPlugin:
391 Activate the isolation plugin to isolate changes to external
392 modules to a single test module or package. The isolation plugin
393 resets the contents of sys.modules after each test module or
394 package runs to its state before the test. PLEASE NOTE that this
395 plugin should not be used with the coverage plugin, or in any other case
396 where module reloading may produce undesirable side\-effects.
397 [NOSE_WITH_ISOLATION]
401 \fB\-d\fR\fR\fR, \fB\-\-detailed\-errors\fR\fR\fR, \fB\-\-failure\-detail\fR\fR
402 Add detail to error output by attempting to evaluate failed asserts [NOSE_DETAILED_ERRORS]
406 \fB\-\-with\-profile\fR\fR
407 Enable plugin Profile:
408 Use this plugin to run tests using the hotshot profiler.
413 \fB\-\-profile\-sort\fR\fR=SORT
414 Set sort order for profiler output
418 \fB\-\-profile\-stats\-file\fR\fR=FILE
419 Profiler stats file; default is a new temp file on each run
423 \fB\-\-profile\-restrict\fR\fR=RESTRICT
424 Restrict profiler output. See help for pstats.Stats for details
428 \fB\-\-no\-skip\fR\fR
429 Disable special handling of SkipTest exceptions.
433 \fB\-\-with\-id\fR\fR
434 Enable plugin TestId:
435 Activate to add a test id (like #1) to each test name output. Activate
436 with \-\-failed to rerun failing tests only.
441 \fB\-\-id\-file\fR\fR=FILE
442 Store test ids found in test runs in this file. Default is the file .noseids in the working directory.
447 Run the tests that failed in the last test run.
451 \fB\-\-processes\fR\fR=NUM
452 Spread test run among this many processes. Set a number equal to the number of processors or cores in your machine for best results. [NOSE_PROCESSES]
456 \fB\-\-process\-timeout\fR\fR=SECONDS
457 Set timeout for return of results from each test runner process. [NOSE_PROCESS_TIMEOUT]
461 \fB\-\-process\-restartworker\fR\fR
462 If set, will restart each worker process once their tests are done, this helps control memory leaks from killing the system. [NOSE_PROCESS_RESTARTWORKER]
466 \fB\-\-with\-xunit\fR\fR
467 Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]
471 \fB\-\-xunit\-file\fR\fR=FILE
472 Path to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]
476 \fB\-\-all\-modules\fR\fR
477 Enable plugin AllModules: Collect tests from all python modules.
482 \fB\-\-collect\-only\fR\fR
483 Enable collect\-only:
484 Collect and output test names only, don\'t run any tests.
489 jpellerin+nose@gmail.com
494 .\" Generated by docutils manpage writer on 2012-09-03 09:06.