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 0.11 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.
133
All plugins written for nose 0.10 should work with nose 0.11.
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\-m\fR\fR=REGEX\fR, \fB\-\-match\fR\fR=REGEX\fR, \fB\-\-testmatch\fR\fR=REGEX
175
Files, directories, function names, and class names that match this regular expression are considered tests. Default: (?:^|[b_./\-])[Tt]est [NOSE_TESTMATCH]
179
\fB\-\-tests\fR\fR=NAMES
180
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.
184
\fB\-l\fR\fR=DEFAULT\fR, \fB\-\-debug\fR\fR=DEFAULT
185
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.
189
\fB\-\-debug\-log\fR\fR=FILE
190
Log debug messages to this file (default: sys.stderr)
194
\fB\-\-logging\-config\fR\fR=FILE\fR, \fB\-\-log\-config\fR\fR=FILE
195
Load logging config from this file \-\- bypasses all other logging config settings.
199
\fB\-e\fR\fR=REGEX\fR, \fB\-\-exclude\fR\fR=REGEX
200
Don\'t run tests that match regular expression [NOSE_EXCLUDE]
204
\fB\-i\fR\fR=REGEX\fR, \fB\-\-include\fR\fR=REGEX
205
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]
209
\fB\-x\fR\fR\fR, \fB\-\-stop\fR\fR
210
Stop running tests after the first error or failure
214
\fB\-P\fR\fR\fR, \fB\-\-no\-path\-adjustment\fR\fR
215
Don\'t make any changes to sys.path when loading tests [NOSE_NOPATH]
220
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]
225
DO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)
229
\fB\-\-traverse\-namespace\fR\fR
230
Traverse through all path entries of a namespace package
234
\fB\-\-first\-package\-wins\fR\fR=DEFAULT\fR, \fB\-\-first\-pkg\-wins\fR\fR=DEFAULT\fR, \fB\-\-1st\-pkg\-wins\fR\fR=DEFAULT
235
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.
239
\fB\-a\fR\fR=ATTR\fR, \fB\-\-attr\fR\fR=ATTR
240
Run only tests that have attributes specified by ATTR [NOSE_ATTR]
244
\fB\-A\fR\fR=EXPR\fR, \fB\-\-eval\-attr\fR\fR=EXPR
245
Run only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR]
249
\fB\-s\fR\fR\fR, \fB\-\-nocapture\fR\fR
250
Don\'t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]
254
\fB\-\-nologcapture\fR\fR
255
Disable logging capture plugin. Logging configurtion will be left intact. [NOSE_NOLOGCAPTURE]
259
\fB\-\-logging\-format\fR\fR=FORMAT
260
Specify custom format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGFORMAT]
264
\fB\-\-logging\-datefmt\fR\fR=FORMAT
265
Specify custom date/time format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGDATEFMT]
269
\fB\-\-logging\-filter\fR\fR=FILTER
270
Specify which statements to filter in/out. By default, everything is captured. If the output is too verbose,
271
use this option to filter out needless output.
272
Example: filter=foo will capture statements issued ONLY to
273
foo or foo.what.ever.sub but not foobar or other logger.
274
Specify multiple loggers with comma: filter=foo,bar,baz.
275
If any logger name is prefixed with a minus, eg filter=\-foo,
276
it will be excluded rather than included. Default: exclude logging messages from nose itself (\-nose). [NOSE_LOGFILTER]
280
\fB\-\-logging\-clear\-handlers\fR\fR
281
Clear all other logging handlers
285
\fB\-\-with\-coverage\fR\fR
286
Enable plugin Coverage:
287
Activate a coverage report using Ned Batchelder\'s coverage module.
292
\fB\-\-cover\-package\fR\fR=PACKAGE
293
Restrict coverage output to selected packages [NOSE_COVER_PACKAGE]
297
\fB\-\-cover\-erase\fR\fR
298
Erase previously collected coverage statistics before run
302
\fB\-\-cover\-tests\fR\fR
303
Include test modules in coverage report [NOSE_COVER_TESTS]
307
\fB\-\-cover\-inclusive\fR\fR
308
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]
312
\fB\-\-cover\-html\fR\fR
313
Produce HTML coverage information
317
\fB\-\-cover\-html\-dir\fR\fR=DIR
318
Produce HTML coverage information in dir
323
Drop into debugger on errors
327
\fB\-\-pdb\-failures\fR\fR
328
Drop into debugger on failures
332
\fB\-\-no\-deprecated\fR\fR
333
Disable special handling of DeprecatedTest exceptions.
337
\fB\-\-with\-doctest\fR\fR
338
Enable plugin Doctest:
339
Activate doctest plugin to find and run doctests in non\-test modules.
344
\fB\-\-doctest\-tests\fR\fR
345
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]
349
\fB\-\-doctest\-extension\fR\fR=EXT
350
Also look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]
354
\fB\-\-doctest\-result\-variable\fR\fR=VAR
355
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]
359
\fB\-\-doctest\-fixtures\fR\fR=SUFFIX
360
Find fixtures for a doctest file in module with this name appended to the base name of the doctest file
364
\fB\-\-with\-isolation\fR\fR
365
Enable plugin IsolationPlugin:
366
Activate the isolation plugin to isolate changes to external
367
modules to a single test module or package. The isolation plugin
368
resets the contents of sys.modules after each test module or
369
package runs to its state before the test. PLEASE NOTE that this
370
plugin should not be used with the coverage plugin, or in any other case
371
where module reloading may produce undesirable side\-effects.
372
[NOSE_WITH_ISOLATION]
376
\fB\-d\fR\fR\fR, \fB\-\-detailed\-errors\fR\fR\fR, \fB\-\-failure\-detail\fR\fR
377
Add detail to error output by attempting to evaluate failed asserts [NOSE_DETAILED_ERRORS]
381
\fB\-\-with\-profile\fR\fR
382
Enable plugin Profile:
383
Use this plugin to run tests using the hotshot profiler.
388
\fB\-\-profile\-sort\fR\fR=SORT
389
Set sort order for profiler output
393
\fB\-\-profile\-stats\-file\fR\fR=FILE
394
Profiler stats file; default is a new temp file on each run
398
\fB\-\-profile\-restrict\fR\fR=RESTRICT
399
Restrict profiler output. See help for pstats.Stats for details
403
\fB\-\-no\-skip\fR\fR
404
Disable special handling of SkipTest exceptions.
408
\fB\-\-with\-id\fR\fR
409
Enable plugin TestId:
410
Activate to add a test id (like #1) to each test name output. Activate
411
with \-\-failed to rerun failing tests only.
416
\fB\-\-id\-file\fR\fR=FILE
417
Store test ids found in test runs in this file. Default is the file .noseids in the working directory.
422
Run the tests that failed in the last test run.
426
\fB\-\-processes\fR\fR=NUM
427
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]
431
\fB\-\-process\-timeout\fR\fR=SECONDS
432
Set timeout for return of results from each test runner process. [NOSE_PROCESS_TIMEOUT]
436
\fB\-\-with\-xunit\fR\fR
437
Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]
441
\fB\-\-xunit\-file\fR\fR=FILE
442
Path to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]
446
\fB\-\-all\-modules\fR\fR
447
Enable plugin AllModules: Collect tests from all python modules.
452
\fB\-\-collect\-only\fR\fR
453
Enable collect\-only:
454
Collect and output test names only, don\'t run any tests.
459
jpellerin+nose@gmail.com
464
.\" Generated by docutils manpage writer on 2010-03-05 15:32.