PageRenderTime 538ms CodeModel.GetById 171ms app.highlight 130ms RepoModel.GetById 202ms app.codeStats 30ms

/nosetests.1

https://bitbucket.org/jpellerin/nose/
text | 495 lines | 332 code | 163 blank | 0 comment | 0 complexity | 084d13f7cf7ab42edfb60312691e25b7 MD5 | raw file
  1.TH nosetests 1 "2009-04-23" "0.11" "User Commands"
  2.SH NAME
  3nosetests \- 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
 11nosetests [options] [names]
 12
 13.UNINDENT
 14.UNINDENT
 15
 16.SH DESCRIPTION
 17nose collects tests automatically from python source files,
 18directories and packages found in its working directory (which
 19defaults to the current working directory). Any python source file,
 20directory or package that matches the testMatch regular expression
 21(by default: \fI(?:^|[b_.\-])[Tt]est)\fP will be collected as a test (or
 22source for collection of tests). In addition, all other packages
 23found in the working directory will be examined for python source files
 24or directories that match testMatch. Package discovery descends all
 25the way down the tree, so package.tests and package.sub.tests and
 26package.sub.sub2.tests will all be collected.
 27
 28Within a test directory or package, any python source file matching
 29testMatch will be examined for test cases. Within a test module,
 30functions and classes whose names match testMatch and TestCase
 31subclasses with any name will be loaded and executed as tests. Tests
 32may use the assert keyword or raise AssertionErrors to indicate test
 33failure. TestCase subclasses may do the same or use the various
 34TestCase methods available.
 35
 36
 37.SS Selecting Tests
 38To specify which tests to run, pass test names on the command line:
 39
 40
 41.nf
 42nosetests only_test_this.py
 43.fi
 44Test names specified may be file or module names, and may optionally
 45indicate the test case to run by separating the module or file name
 46from the test case name with a colon. Filenames may be relative or
 47absolute. Examples:
 48
 49
 50.nf
 51nosetests test.module
 52nosetests another.test:TestCase.test_method
 53nosetests a.test:TestCase
 54nosetests /path/to/test/file.py:test_function
 55.fi
 56You may also change the working directory where nose looks for tests
 57by using the \-w switch:
 58
 59
 60.nf
 61nosetests \-w /path/to/tests
 62.fi
 63Note, however, that support for multiple \-w arguments is now deprecated
 64and will be removed in a future release. As of nose 0.10, you can get
 65the same behavior by specifying the target directories \fIwithout\fP
 66the \-w switch:
 67
 68
 69.nf
 70nosetests /path/to/tests /another/path/to/tests
 71.fi
 72Further customization of test selection and loading is possible
 73through the use of plugins.
 74
 75Test result output is identical to that of unittest, except for
 76the additional features (error classes, and plugin\-supplied
 77features such as output capture and assert introspection) detailed
 78in the options below.
 79
 80
 81.SS Configuration
 82In addition to passing command\-line options, you may also put
 83configuration options in your project\'s \fIsetup.cfg\fP file, or a .noserc
 84or 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,
 87with the \-\- prefix removed. For options that are simple switches, you
 88must supply a value:
 89
 90
 91.nf
 92[nosetests]
 93verbosity=3
 94with\-doctest=1
 95.fi
 96All configuration files that are found will be loaded and their
 97options combined. You can override the standard config file loading
 98with the \fB\-c\fP option.
 99
100
101.SS Using Plugins
102There are numerous nose plugins available via easy_install and
103elsewhere. To use a plugin, just install it. The plugin will add
104command line options to nosetests. To verify that the plugin is installed,
105run:
106
107
108.nf
109nosetests \-\-plugins
110.fi
111You can add \-v or \-vv to that command to show more information
112about each plugin.
113
114If you are running nose.main() or nose.run() from a script, you
115can specify a list of plugins to use by passing a list of plugins
116with the plugins keyword argument.
117
118
119.SS 0.9 plugins
120nose 1.0 can use SOME plugins that were written for nose 0.9. The
121default plugin manager inserts a compatibility wrapper around 0.9
122plugins that adapts the changed plugin api calls. However, plugins
123that access nose internals are likely to fail, especially if they
124attempt to access test case or test suite classes. For example,
125plugins that try to determine if a test passed to startTest is an
126individual test or a suite will fail, partly because suites are no
127longer passed to startTest and partly because it\'s likely that the
128plugin is trying to find out if the test is an instance of a class
129that no longer exists.
130
131
132.SS 0.10 and 0.11 plugins
133All plugins written for nose 0.10 and 0.11 should work with nose 1.0.
134
135
136.SS Options
137
138.TP
139\fB\-V\fR\fR\fR, \fB\-\-version\fR\fR
140Output nose version and exit
141
142
143.TP
144\fB\-p\fR\fR\fR, \fB\-\-plugins\fR\fR
145Output 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
150Be more verbose. [NOSE_VERBOSE]
151
152
153.TP
154\fB\-\-verbosity\fR\fR=VERBOSITY
155Set verbosity; \-\-verbosity=2 is the same as \-v
156
157
158.TP
159\fB\-q\fR\fR=DEFAULT\fR, \fB\-\-quiet\fR\fR=DEFAULT
160Be less verbose
161
162
163.TP
164\fB\-c\fR\fR=FILES\fR, \fB\-\-config\fR\fR=FILES
165Load 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
170Look 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\-\-py3where\fR\fR=PY3WHERE
175Look 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]
176
177
178.TP
179\fB\-m\fR\fR=REGEX\fR, \fB\-\-match\fR\fR=REGEX\fR, \fB\-\-testmatch\fR\fR=REGEX
180Files, directories, function names, and class names that match this regular expression are considered tests.  Default: (?:^|[b_./\-])[Tt]est [NOSE_TESTMATCH]
181
182
183.TP
184\fB\-\-tests\fR\fR=NAMES
185Run 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.
186
187
188.TP
189\fB\-l\fR\fR=DEFAULT\fR, \fB\-\-debug\fR\fR=DEFAULT
190Activate 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.
191
192
193.TP
194\fB\-\-debug\-log\fR\fR=FILE
195Log debug messages to this file (default: sys.stderr)
196
197
198.TP
199\fB\-\-logging\-config\fR\fR=FILE\fR, \fB\-\-log\-config\fR\fR=FILE
200Load logging config from this file \-\- bypasses all other logging config settings.
201
202
203.TP
204\fB\-I\fR\fR=REGEX\fR, \fB\-\-ignore\-files\fR\fR=REGEX
205Completely 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]
206
207
208.TP
209\fB\-e\fR\fR=REGEX\fR, \fB\-\-exclude\fR\fR=REGEX
210Don\'t run tests that match regular expression [NOSE_EXCLUDE]
211
212
213.TP
214\fB\-i\fR\fR=REGEX\fR, \fB\-\-include\fR\fR=REGEX
215This 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]
216
217
218.TP
219\fB\-x\fR\fR\fR, \fB\-\-stop\fR\fR
220Stop running tests after the first error or failure
221
222
223.TP
224\fB\-P\fR\fR\fR, \fB\-\-no\-path\-adjustment\fR\fR
225Don\'t make any changes to sys.path when loading tests [NOSE_NOPATH]
226
227
228.TP
229\fB\-\-exe\fR\fR
230Look 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]
231
232
233.TP
234\fB\-\-noexe\fR\fR
235DO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)
236
237
238.TP
239\fB\-\-traverse\-namespace\fR\fR
240Traverse through all path entries of a namespace package
241
242
243.TP
244\fB\-\-first\-package\-wins\fR\fR\fR, \fB\-\-first\-pkg\-wins\fR\fR\fR, \fB\-\-1st\-pkg\-wins\fR\fR
245nose\'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.
246
247
248.TP
249\fB\-a\fR\fR=ATTR\fR, \fB\-\-attr\fR\fR=ATTR
250Run only tests that have attributes specified by ATTR [NOSE_ATTR]
251
252
253.TP
254\fB\-A\fR\fR=EXPR\fR, \fB\-\-eval\-attr\fR\fR=EXPR
255Run only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR]
256
257
258.TP
259\fB\-s\fR\fR\fR, \fB\-\-nocapture\fR\fR
260Don\'t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]
261
262
263.TP
264\fB\-\-nologcapture\fR\fR
265Disable logging capture plugin. Logging configurtion will be left intact. [NOSE_NOLOGCAPTURE]
266
267
268.TP
269\fB\-\-logging\-format\fR\fR=FORMAT
270Specify custom format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGFORMAT]
271
272
273.TP
274\fB\-\-logging\-datefmt\fR\fR=FORMAT
275Specify custom date/time format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGDATEFMT]
276
277
278.TP
279\fB\-\-logging\-filter\fR\fR=FILTER
280Specify which statements to filter in/out. By default, everything is captured. If the output is too verbose,
281use this option to filter out needless output.
282Example: filter=foo will capture statements issued ONLY to
283 foo or foo.what.ever.sub but not foobar or other logger.
284Specify multiple loggers with comma: filter=foo,bar,baz.
285If any logger name is prefixed with a minus, eg filter=\-foo,
286it will be excluded rather than included. Default: exclude logging messages from nose itself (\-nose). [NOSE_LOGFILTER]
287
288
289.TP
290\fB\-\-logging\-clear\-handlers\fR\fR
291Clear all other logging handlers
292
293
294.TP
295\fB\-\-with\-coverage\fR\fR
296Enable plugin Coverage: 
297Activate a coverage report using Ned Batchelder\'s coverage module.
298 [NOSE_WITH_COVERAGE]
299
300
301.TP
302\fB\-\-cover\-package\fR\fR=PACKAGE
303Restrict coverage output to selected packages [NOSE_COVER_PACKAGE]
304
305
306.TP
307\fB\-\-cover\-erase\fR\fR
308Erase previously collected coverage statistics before run
309
310
311.TP
312\fB\-\-cover\-tests\fR\fR
313Include test modules in coverage report [NOSE_COVER_TESTS]
314
315
316.TP
317\fB\-\-cover\-inclusive\fR\fR
318Include 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]
319
320
321.TP
322\fB\-\-cover\-html\fR\fR
323Produce HTML coverage information
324
325
326.TP
327\fB\-\-cover\-html\-dir\fR\fR=DIR
328Produce HTML coverage information in dir
329
330
331.TP
332\fB\-\-cover\-branches\fR\fR
333Include branch coverage in coverage report [NOSE_COVER_BRANCHES]
334
335
336.TP
337\fB\-\-cover\-xml\fR\fR
338Produce XML coverage information
339
340
341.TP
342\fB\-\-cover\-xml\-file\fR\fR=FILE
343Produce XML coverage information in file
344
345
346.TP
347\fB\-\-pdb\fR\fR
348Drop into debugger on errors
349
350
351.TP
352\fB\-\-pdb\-failures\fR\fR
353Drop into debugger on failures
354
355
356.TP
357\fB\-\-no\-deprecated\fR\fR
358Disable special handling of DeprecatedTest exceptions.
359
360
361.TP
362\fB\-\-with\-doctest\fR\fR
363Enable plugin Doctest: 
364Activate doctest plugin to find and run doctests in non\-test modules.
365 [NOSE_WITH_DOCTEST]
366
367
368.TP
369\fB\-\-doctest\-tests\fR\fR
370Also 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]
371
372
373.TP
374\fB\-\-doctest\-extension\fR\fR=EXT
375Also look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]
376
377
378.TP
379\fB\-\-doctest\-result\-variable\fR\fR=VAR
380Change 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]
381
382
383.TP
384\fB\-\-doctest\-fixtures\fR\fR=SUFFIX
385Find fixtures for a doctest file in module with this name appended to the base name of the doctest file
386
387
388.TP
389\fB\-\-with\-isolation\fR\fR
390Enable plugin IsolationPlugin: 
391Activate the isolation plugin to isolate changes to external
392modules to a single test module or package. The isolation plugin
393resets the contents of sys.modules after each test module or
394package runs to its state before the test. PLEASE NOTE that this
395plugin should not be used with the coverage plugin, or in any other case
396where module reloading may produce undesirable side\-effects.
397 [NOSE_WITH_ISOLATION]
398
399
400.TP
401\fB\-d\fR\fR\fR, \fB\-\-detailed\-errors\fR\fR\fR, \fB\-\-failure\-detail\fR\fR
402Add detail to error output by attempting to evaluate failed asserts [NOSE_DETAILED_ERRORS]
403
404
405.TP
406\fB\-\-with\-profile\fR\fR
407Enable plugin Profile: 
408Use this plugin to run tests using the hotshot profiler. 
409 [NOSE_WITH_PROFILE]
410
411
412.TP
413\fB\-\-profile\-sort\fR\fR=SORT
414Set sort order for profiler output
415
416
417.TP
418\fB\-\-profile\-stats\-file\fR\fR=FILE
419Profiler stats file; default is a new temp file on each run
420
421
422.TP
423\fB\-\-profile\-restrict\fR\fR=RESTRICT
424Restrict profiler output. See help for pstats.Stats for details
425
426
427.TP
428\fB\-\-no\-skip\fR\fR
429Disable special handling of SkipTest exceptions.
430
431
432.TP
433\fB\-\-with\-id\fR\fR
434Enable plugin TestId: 
435Activate to add a test id (like #1) to each test name output. Activate
436with \-\-failed to rerun failing tests only.
437 [NOSE_WITH_ID]
438
439
440.TP
441\fB\-\-id\-file\fR\fR=FILE
442Store test ids found in test runs in this file. Default is the file .noseids in the working directory.
443
444
445.TP
446\fB\-\-failed\fR\fR
447Run the tests that failed in the last test run.
448
449
450.TP
451\fB\-\-processes\fR\fR=NUM
452Spread 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]
453
454
455.TP
456\fB\-\-process\-timeout\fR\fR=SECONDS
457Set timeout for return of results from each test runner process. [NOSE_PROCESS_TIMEOUT]
458
459
460.TP
461\fB\-\-process\-restartworker\fR\fR
462If set, will restart each worker process once their tests are done, this helps control memory leaks from killing the system. [NOSE_PROCESS_RESTARTWORKER]
463
464
465.TP
466\fB\-\-with\-xunit\fR\fR
467Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]
468
469
470.TP
471\fB\-\-xunit\-file\fR\fR=FILE
472Path to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]
473
474
475.TP
476\fB\-\-all\-modules\fR\fR
477Enable plugin AllModules: Collect tests from all python modules.
478 [NOSE_ALL_MODULES]
479
480
481.TP
482\fB\-\-collect\-only\fR\fR
483Enable collect\-only: 
484Collect and output test names only, don\'t run any tests.
485 [COLLECT_ONLY]
486
487
488.SH AUTHOR
489jpellerin+nose@gmail.com
490
491.SH COPYRIGHT
492LGPL
493
494.\" Generated by docutils manpage writer on 2011-10-10 09:32.
495.\"