~plane1/maus/devel_624

« back to all changes in this revision

Viewing changes to third_party/nose-0.11.3/man/man1/nosetests.1

  • Committer: tunnell
  • Date: 2010-09-30 13:56:05 UTC
  • Revision ID: tunnell@itchy-20100930135605-wxbkfgy75p0sndk3
add third party

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH nosetests 1 "2009-04-23" "0.11" "User Commands"
 
2
.SH NAME
 
3
nosetests \- nicer testing for python
 
4
.\" Man page generated from reStructeredText.
 
5
.INDENT 0.0
 
6
.UNINDENT
 
7
 
 
8
.SH SYNOPSIS
 
9
.INDENT 0.0
 
10
.INDENT 3.5
 
11
nosetests [options] [names]
 
12
 
 
13
.UNINDENT
 
14
.UNINDENT
 
15
 
 
16
.SH DESCRIPTION
 
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.
 
27
 
 
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.
 
35
 
 
36
 
 
37
.SS Selecting Tests
 
38
To specify which tests to run, pass test names on the command line:
 
39
 
 
40
 
 
41
.nf
 
42
nosetests only_test_this.py
 
43
.fi
 
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
 
47
absolute. Examples:
 
48
 
 
49
 
 
50
.nf
 
51
nosetests test.module
 
52
nosetests another.test:TestCase.test_method
 
53
nosetests a.test:TestCase
 
54
nosetests /path/to/test/file.py:test_function
 
55
.fi
 
56
You may also change the working directory where nose looks for tests
 
57
by using the \-w switch:
 
58
 
 
59
 
 
60
.nf
 
61
nosetests \-w /path/to/tests
 
62
.fi
 
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
 
66
the \-w switch:
 
67
 
 
68
 
 
69
.nf
 
70
nosetests /path/to/tests /another/path/to/tests
 
71
.fi
 
72
Further customization of test selection and loading is possible
 
73
through the use of plugins.
 
74
 
 
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
 
78
in the options below.
 
79
 
 
80
 
 
81
.SS Configuration
 
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
 
88
must supply a value:
 
89
 
 
90
 
 
91
.nf
 
92
[nosetests]
 
93
verbosity=3
 
94
with\-doctest=1
 
95
.fi
 
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.
 
99
 
 
100
 
 
101
.SS Using Plugins
 
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,
 
105
run:
 
106
 
 
107
 
 
108
.nf
 
109
nosetests \-\-plugins
 
110
.fi
 
111
You can add \-v or \-vv to that command to show more information
 
112
about each plugin.
 
113
 
 
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.
 
117
 
 
118
 
 
119
.SS 0.9 plugins
 
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.
 
130
 
 
131
 
 
132
.SS 0.10 plugins
 
133
All plugins written for nose 0.10 should work with nose 0.11.
 
134
 
 
135
 
 
136
.SS Options
 
137
 
 
138
.TP
 
139
\fB\-V\fR\fR\fR, \fB\-\-version\fR\fR
 
140
Output nose version and exit
 
141
 
 
142
 
 
143
.TP
 
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
 
146
 
 
147
 
 
148
.TP
 
149
\fB\-v\fR\fR=DEFAULT\fR, \fB\-\-verbose\fR\fR=DEFAULT
 
150
Be more verbose. [NOSE_VERBOSE]
 
151
 
 
152
 
 
153
.TP
 
154
\fB\-\-verbosity\fR\fR=VERBOSITY
 
155
Set verbosity; \-\-verbosity=2 is the same as \-v
 
156
 
 
157
 
 
158
.TP
 
159
\fB\-q\fR\fR=DEFAULT\fR, \fB\-\-quiet\fR\fR=DEFAULT
 
160
Be less verbose
 
161
 
 
162
 
 
163
.TP
 
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
 
166
 
 
167
 
 
168
.TP
 
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]
 
171
 
 
172
 
 
173
.TP
 
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]
 
176
 
 
177
 
 
178
.TP
 
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.
 
181
 
 
182
 
 
183
.TP
 
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.
 
186
 
 
187
 
 
188
.TP
 
189
\fB\-\-debug\-log\fR\fR=FILE
 
190
Log debug messages to this file (default: sys.stderr)
 
191
 
 
192
 
 
193
.TP
 
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.
 
196
 
 
197
 
 
198
.TP
 
199
\fB\-e\fR\fR=REGEX\fR, \fB\-\-exclude\fR\fR=REGEX
 
200
Don\'t run tests that match regular expression [NOSE_EXCLUDE]
 
201
 
 
202
 
 
203
.TP
 
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]
 
206
 
 
207
 
 
208
.TP
 
209
\fB\-x\fR\fR\fR, \fB\-\-stop\fR\fR
 
210
Stop running tests after the first error or failure
 
211
 
 
212
 
 
213
.TP
 
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]
 
216
 
 
217
 
 
218
.TP
 
219
\fB\-\-exe\fR\fR
 
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]
 
221
 
 
222
 
 
223
.TP
 
224
\fB\-\-noexe\fR\fR
 
225
DO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)
 
226
 
 
227
 
 
228
.TP
 
229
\fB\-\-traverse\-namespace\fR\fR
 
230
Traverse through all path entries of a namespace package
 
231
 
 
232
 
 
233
.TP
 
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.
 
236
 
 
237
 
 
238
.TP
 
239
\fB\-a\fR\fR=ATTR\fR, \fB\-\-attr\fR\fR=ATTR
 
240
Run only tests that have attributes specified by ATTR [NOSE_ATTR]
 
241
 
 
242
 
 
243
.TP
 
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]
 
246
 
 
247
 
 
248
.TP
 
249
\fB\-s\fR\fR\fR, \fB\-\-nocapture\fR\fR
 
250
Don\'t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]
 
251
 
 
252
 
 
253
.TP
 
254
\fB\-\-nologcapture\fR\fR
 
255
Disable logging capture plugin. Logging configurtion will be left intact. [NOSE_NOLOGCAPTURE]
 
256
 
 
257
 
 
258
.TP
 
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]
 
261
 
 
262
 
 
263
.TP
 
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]
 
266
 
 
267
 
 
268
.TP
 
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]
 
277
 
 
278
 
 
279
.TP
 
280
\fB\-\-logging\-clear\-handlers\fR\fR
 
281
Clear all other logging handlers
 
282
 
 
283
 
 
284
.TP
 
285
\fB\-\-with\-coverage\fR\fR
 
286
Enable plugin Coverage: 
 
287
Activate a coverage report using Ned Batchelder\'s coverage module.
 
288
 [NOSE_WITH_COVERAGE]
 
289
 
 
290
 
 
291
.TP
 
292
\fB\-\-cover\-package\fR\fR=PACKAGE
 
293
Restrict coverage output to selected packages [NOSE_COVER_PACKAGE]
 
294
 
 
295
 
 
296
.TP
 
297
\fB\-\-cover\-erase\fR\fR
 
298
Erase previously collected coverage statistics before run
 
299
 
 
300
 
 
301
.TP
 
302
\fB\-\-cover\-tests\fR\fR
 
303
Include test modules in coverage report [NOSE_COVER_TESTS]
 
304
 
 
305
 
 
306
.TP
 
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]
 
309
 
 
310
 
 
311
.TP
 
312
\fB\-\-cover\-html\fR\fR
 
313
Produce HTML coverage information
 
314
 
 
315
 
 
316
.TP
 
317
\fB\-\-cover\-html\-dir\fR\fR=DIR
 
318
Produce HTML coverage information in dir
 
319
 
 
320
 
 
321
.TP
 
322
\fB\-\-pdb\fR\fR
 
323
Drop into debugger on errors
 
324
 
 
325
 
 
326
.TP
 
327
\fB\-\-pdb\-failures\fR\fR
 
328
Drop into debugger on failures
 
329
 
 
330
 
 
331
.TP
 
332
\fB\-\-no\-deprecated\fR\fR
 
333
Disable special handling of DeprecatedTest exceptions.
 
334
 
 
335
 
 
336
.TP
 
337
\fB\-\-with\-doctest\fR\fR
 
338
Enable plugin Doctest: 
 
339
Activate doctest plugin to find and run doctests in non\-test modules.
 
340
 [NOSE_WITH_DOCTEST]
 
341
 
 
342
 
 
343
.TP
 
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]
 
346
 
 
347
 
 
348
.TP
 
349
\fB\-\-doctest\-extension\fR\fR=EXT
 
350
Also look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]
 
351
 
 
352
 
 
353
.TP
 
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]
 
356
 
 
357
 
 
358
.TP
 
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
 
361
 
 
362
 
 
363
.TP
 
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]
 
373
 
 
374
 
 
375
.TP
 
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]
 
378
 
 
379
 
 
380
.TP
 
381
\fB\-\-with\-profile\fR\fR
 
382
Enable plugin Profile: 
 
383
Use this plugin to run tests using the hotshot profiler. 
 
384
 [NOSE_WITH_PROFILE]
 
385
 
 
386
 
 
387
.TP
 
388
\fB\-\-profile\-sort\fR\fR=SORT
 
389
Set sort order for profiler output
 
390
 
 
391
 
 
392
.TP
 
393
\fB\-\-profile\-stats\-file\fR\fR=FILE
 
394
Profiler stats file; default is a new temp file on each run
 
395
 
 
396
 
 
397
.TP
 
398
\fB\-\-profile\-restrict\fR\fR=RESTRICT
 
399
Restrict profiler output. See help for pstats.Stats for details
 
400
 
 
401
 
 
402
.TP
 
403
\fB\-\-no\-skip\fR\fR
 
404
Disable special handling of SkipTest exceptions.
 
405
 
 
406
 
 
407
.TP
 
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.
 
412
 [NOSE_WITH_ID]
 
413
 
 
414
 
 
415
.TP
 
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.
 
418
 
 
419
 
 
420
.TP
 
421
\fB\-\-failed\fR\fR
 
422
Run the tests that failed in the last test run.
 
423
 
 
424
 
 
425
.TP
 
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]
 
428
 
 
429
 
 
430
.TP
 
431
\fB\-\-process\-timeout\fR\fR=SECONDS
 
432
Set timeout for return of results from each test runner process. [NOSE_PROCESS_TIMEOUT]
 
433
 
 
434
 
 
435
.TP
 
436
\fB\-\-with\-xunit\fR\fR
 
437
Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]
 
438
 
 
439
 
 
440
.TP
 
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]
 
443
 
 
444
 
 
445
.TP
 
446
\fB\-\-all\-modules\fR\fR
 
447
Enable plugin AllModules: Collect tests from all python modules.
 
448
 [NOSE_ALL_MODULES]
 
449
 
 
450
 
 
451
.TP
 
452
\fB\-\-collect\-only\fR\fR
 
453
Enable collect\-only: 
 
454
Collect and output test names only, don\'t run any tests.
 
455
 [COLLECT_ONLY]
 
456
 
 
457
 
 
458
.SH AUTHOR
 
459
jpellerin+nose@gmail.com
 
460
 
 
461
.SH COPYRIGHT
 
462
LGPL
 
463
 
 
464
.\" Generated by docutils manpage writer on 2010-03-05 15:32.
 
465
.\"