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