/usr/share/doc/python-nose-doc/html/usage.html is in python-nose-doc 1.3.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basic usage — nose 1.3.7 documentation</title>
<link rel="stylesheet" href="_static/nose.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.3.7',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="nose 1.3.7 documentation" href="index.html" />
<link rel="up" title="Testing with nose" href="testing.html" />
<link rel="next" title="Writing tests" href="writing_tests.html" />
<link rel="prev" title="Testing with nose" href="testing.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="writing_tests.html" title="Writing tests"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="testing.html" title="Testing with nose"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">nose 1.3.7 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="testing.html" accesskey="U">Testing with nose</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="basic-usage">
<h1>Basic usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h1>
<p>Use the nosetests script (after installation by setuptools):</p>
<div class="highlight-python"><div class="highlight"><pre>nosetests [options] [(optional) test files or directories]
</pre></div>
</div>
<p>In addition to passing command-line options, you may also put configuration
options in a .noserc or nose.cfg file in your home directory. These are
standard .ini-style config files. Put your nosetests configuration in a
[nosetests] section, with the – prefix removed:</p>
<div class="highlight-python"><div class="highlight"><pre>[nosetests]
verbosity=3
with-doctest=1
</pre></div>
</div>
<p>There is also possiblity to disable configuration files loading (might be
useful when runnig i.e. tox and you don’t want your global nose config file to
be used by tox). In order to ignore those configuration files simply set an
environment variable <code class="docutils literal"><span class="pre">NOSE_IGNORE_CONFIG_FILES</span></code>.</p>
<p>There are several other ways to use the nose test runner besides the
<cite>nosetests</cite> script. You may use nose in a test script:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">nose</span>
<span class="n">nose</span><span class="o">.</span><span class="n">main</span><span class="p">()</span>
</pre></div>
</div>
<p>If you don’t want the test script to exit with 0 on success and 1 on failure
(like unittest.main), use nose.run() instead:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">nose</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">nose</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
</pre></div>
</div>
<p><cite>result</cite> will be true if the test run succeeded, or false if any test failed
or raised an uncaught exception. Lastly, you can run nose.core directly, which
will run nose.main():</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">python</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">nose</span><span class="o">/</span><span class="n">core</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>Please see the usage message for the nosetests script for information
about how to control which tests nose runs, which plugins are loaded,
and the test output.</p>
<div class="section" id="extended-usage">
<h2>Extended usage<a class="headerlink" href="#extended-usage" title="Permalink to this headline">¶</a></h2>
<p>nose collects tests automatically from python source files,
directories and packages found in its working directory (which
defaults to the current working directory). Any python source file,
directory or package that matches the testMatch regular expression
(by default: <cite>(?:^|[b_.-])[Tt]est)</cite> will be collected as a test (or
source for collection of tests). In addition, all other packages
found in the working directory will be examined for python source files
or directories that match testMatch. Package discovery descends all
the way down the tree, so package.tests and package.sub.tests and
package.sub.sub2.tests will all be collected.</p>
<p>Within a test directory or package, any python source file matching
testMatch will be examined for test cases. Within a test module,
functions and classes whose names match testMatch and TestCase
subclasses with any name will be loaded and executed as tests. Tests
may use the assert keyword or raise AssertionErrors to indicate test
failure. TestCase subclasses may do the same or use the various
TestCase methods available.</p>
<p><strong>It is important to note that the default behavior of nose is to
not include tests from files which are executable.</strong> To include
tests from such files, remove their executable bit or use
the –exe flag (see ‘Options’ section below).</p>
<div class="section" id="selecting-tests">
<h3>Selecting Tests<a class="headerlink" href="#selecting-tests" title="Permalink to this headline">¶</a></h3>
<p>To specify which tests to run, pass test names on the command line:</p>
<div class="highlight-python"><div class="highlight"><pre>nosetests only_test_this.py
</pre></div>
</div>
<p>Test names specified may be file or module names, and may optionally
indicate the test case to run by separating the module or file name
from the test case name with a colon. Filenames may be relative or
absolute. Examples:</p>
<div class="highlight-python"><div class="highlight"><pre>nosetests test.module
nosetests another.test:TestCase.test_method
nosetests a.test:TestCase
nosetests /path/to/test/file.py:test_function
</pre></div>
</div>
<p>You may also change the working directory where nose looks for tests
by using the -w switch:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">nosetests</span> <span class="o">-</span><span class="n">w</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">tests</span>
</pre></div>
</div>
<p>Note, however, that support for multiple -w arguments is now deprecated
and will be removed in a future release. As of nose 0.10, you can get
the same behavior by specifying the target directories <em>without</em>
the -w switch:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">nosetests</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">tests</span> <span class="o">/</span><span class="n">another</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">tests</span>
</pre></div>
</div>
<p>Further customization of test selection and loading is possible
through the use of plugins.</p>
<p>Test result output is identical to that of unittest, except for
the additional features (error classes, and plugin-supplied
features such as output capture and assert introspection) detailed
in the options below.</p>
</div>
<div class="section" id="configuration">
<h3>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h3>
<p>In addition to passing command-line options, you may also put
configuration options in your project’s <em>setup.cfg</em> file, or a .noserc
or nose.cfg file in your home directory. In any of these standard
ini-style config files, you put your nosetests configuration in a
<code class="docutils literal"><span class="pre">[nosetests]</span></code> section. Options are the same as on the command line,
with the – prefix removed. For options that are simple switches, you
must supply a value:</p>
<div class="highlight-python"><div class="highlight"><pre>[nosetests]
verbosity=3
with-doctest=1
</pre></div>
</div>
<p>All configuration files that are found will be loaded and their
options combined. You can override the standard config file loading
with the <code class="docutils literal"><span class="pre">-c</span></code> option.</p>
</div>
<div class="section" id="using-plugins">
<h3>Using Plugins<a class="headerlink" href="#using-plugins" title="Permalink to this headline">¶</a></h3>
<p>There are numerous nose plugins available via easy_install and
elsewhere. To use a plugin, just install it. The plugin will add
command line options to nosetests. To verify that the plugin is installed,
run:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">nosetests</span> <span class="o">--</span><span class="n">plugins</span>
</pre></div>
</div>
<p>You can add -v or -vv to that command to show more information
about each plugin.</p>
<p>If you are running nose.main() or nose.run() from a script, you
can specify a list of plugins to use by passing a list of plugins
with the plugins keyword argument.</p>
</div>
<div class="section" id="plugins">
<h3>0.9 plugins<a class="headerlink" href="#plugins" title="Permalink to this headline">¶</a></h3>
<p>nose 1.0 can use SOME plugins that were written for nose 0.9. The
default plugin manager inserts a compatibility wrapper around 0.9
plugins that adapts the changed plugin api calls. However, plugins
that access nose internals are likely to fail, especially if they
attempt to access test case or test suite classes. For example,
plugins that try to determine if a test passed to startTest is an
individual test or a suite will fail, partly because suites are no
longer passed to startTest and partly because it’s likely that the
plugin is trying to find out if the test is an instance of a class
that no longer exists.</p>
</div>
<div class="section" id="and-0-11-plugins">
<h3>0.10 and 0.11 plugins<a class="headerlink" href="#and-0-11-plugins" title="Permalink to this headline">¶</a></h3>
<p>All plugins written for nose 0.10 and 0.11 should work with nose 1.0.</p>
</div>
<div class="section" id="options">
<h3>Options<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h3>
<dl class="cmdoption">
<dt id="cmdoption-V">
<span id="cmdoption--version"></span><code class="descname">-V</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--version</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-V" title="Permalink to this definition">¶</a></dt>
<dd><p>Output nose version and exit</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-p">
<span id="cmdoption--plugins"></span><code class="descname">-p</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--plugins</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition">¶</a></dt>
<dd><p>Output list of available plugins and exit. Combine with higher verbosity for greater detail</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-v">
<span id="cmdoption--verbose"></span><code class="descname">-v</code><code class="descclassname">=DEFAULT</code><code class="descclassname">, </code><code class="descname">--verbose</code><code class="descclassname">=DEFAULT</code><a class="headerlink" href="#cmdoption-v" title="Permalink to this definition">¶</a></dt>
<dd><p>Be more verbose. [NOSE_VERBOSE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--verbosity">
<code class="descname">--verbosity</code><code class="descclassname">=VERBOSITY</code><a class="headerlink" href="#cmdoption--verbosity" title="Permalink to this definition">¶</a></dt>
<dd><p>Set verbosity; –verbosity=2 is the same as -v</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-q">
<span id="cmdoption--quiet"></span><code class="descname">-q</code><code class="descclassname">=DEFAULT</code><code class="descclassname">, </code><code class="descname">--quiet</code><code class="descclassname">=DEFAULT</code><a class="headerlink" href="#cmdoption-q" title="Permalink to this definition">¶</a></dt>
<dd><p>Be less verbose</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-c">
<span id="cmdoption--config"></span><code class="descname">-c</code><code class="descclassname">=FILES</code><code class="descclassname">, </code><code class="descname">--config</code><code class="descclassname">=FILES</code><a class="headerlink" href="#cmdoption-c" title="Permalink to this definition">¶</a></dt>
<dd><p>Load configuration from config file(s). May be specified multiple times; in that case, all config files will be loaded and combined</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-w">
<span id="cmdoption--where"></span><code class="descname">-w</code><code class="descclassname">=WHERE</code><code class="descclassname">, </code><code class="descname">--where</code><code class="descclassname">=WHERE</code><a class="headerlink" href="#cmdoption-w" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--py3where">
<code class="descname">--py3where</code><code class="descclassname">=PY3WHERE</code><a class="headerlink" href="#cmdoption--py3where" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-m">
<span id="cmdoption--match"></span><span id="cmdoption--testmatch"></span><code class="descname">-m</code><code class="descclassname">=REGEX</code><code class="descclassname">, </code><code class="descname">--match</code><code class="descclassname">=REGEX</code><code class="descclassname">, </code><code class="descname">--testmatch</code><code class="descclassname">=REGEX</code><a class="headerlink" href="#cmdoption-m" title="Permalink to this definition">¶</a></dt>
<dd><p>Files, directories, function names, and class names that match this regular expression are considered tests. Default: (?:^|[b_./-])[Tt]est [NOSE_TESTMATCH]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--tests">
<code class="descname">--tests</code><code class="descclassname">=NAMES</code><a class="headerlink" href="#cmdoption--tests" title="Permalink to this definition">¶</a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-l">
<span id="cmdoption--debug"></span><code class="descname">-l</code><code class="descclassname">=DEFAULT</code><code class="descclassname">, </code><code class="descname">--debug</code><code class="descclassname">=DEFAULT</code><a class="headerlink" href="#cmdoption-l" title="Permalink to this definition">¶</a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--debug-log">
<code class="descname">--debug-log</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--debug-log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log debug messages to this file (default: sys.stderr)</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-config">
<span id="cmdoption--log-config"></span><code class="descname">--logging-config</code><code class="descclassname">=FILE</code><code class="descclassname">, </code><code class="descname">--log-config</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--logging-config" title="Permalink to this definition">¶</a></dt>
<dd><p>Load logging config from this file – bypasses all other logging config settings.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-I">
<span id="cmdoption--ignore-files"></span><code class="descname">-I</code><code class="descclassname">=REGEX</code><code class="descclassname">, </code><code class="descname">--ignore-files</code><code class="descclassname">=REGEX</code><a class="headerlink" href="#cmdoption-I" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-e">
<span id="cmdoption--exclude"></span><code class="descname">-e</code><code class="descclassname">=REGEX</code><code class="descclassname">, </code><code class="descname">--exclude</code><code class="descclassname">=REGEX</code><a class="headerlink" href="#cmdoption-e" title="Permalink to this definition">¶</a></dt>
<dd><p>Don’t run tests that match regular expression [NOSE_EXCLUDE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-i">
<span id="cmdoption--include"></span><code class="descname">-i</code><code class="descclassname">=REGEX</code><code class="descclassname">, </code><code class="descname">--include</code><code class="descclassname">=REGEX</code><a class="headerlink" href="#cmdoption-i" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-x">
<span id="cmdoption--stop"></span><code class="descname">-x</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--stop</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-x" title="Permalink to this definition">¶</a></dt>
<dd><p>Stop running tests after the first error or failure</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-P">
<span id="cmdoption--no-path-adjustment"></span><code class="descname">-P</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--no-path-adjustment</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-P" title="Permalink to this definition">¶</a></dt>
<dd><p>Don’t make any changes to sys.path when loading tests [NOSE_NOPATH]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--exe">
<code class="descname">--exe</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--exe" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--noexe">
<code class="descname">--noexe</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--noexe" title="Permalink to this definition">¶</a></dt>
<dd><p>DO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--traverse-namespace">
<code class="descname">--traverse-namespace</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--traverse-namespace" title="Permalink to this definition">¶</a></dt>
<dd><p>Traverse through all path entries of a namespace package</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--first-package-wins">
<span id="cmdoption--first-pkg-wins"></span><span id="cmdoption--1st-pkg-wins"></span><code class="descname">--first-package-wins</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--first-pkg-wins</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--1st-pkg-wins</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--first-package-wins" title="Permalink to this definition">¶</a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--no-byte-compile">
<code class="descname">--no-byte-compile</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--no-byte-compile" title="Permalink to this definition">¶</a></dt>
<dd><p>Prevent nose from byte-compiling the source into .pyc files while nose is scanning for and running tests.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-a">
<span id="cmdoption--attr"></span><code class="descname">-a</code><code class="descclassname">=ATTR</code><code class="descclassname">, </code><code class="descname">--attr</code><code class="descclassname">=ATTR</code><a class="headerlink" href="#cmdoption-a" title="Permalink to this definition">¶</a></dt>
<dd><p>Run only tests that have attributes specified by ATTR [NOSE_ATTR]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-A">
<span id="cmdoption--eval-attr"></span><code class="descname">-A</code><code class="descclassname">=EXPR</code><code class="descclassname">, </code><code class="descname">--eval-attr</code><code class="descclassname">=EXPR</code><a class="headerlink" href="#cmdoption-A" title="Permalink to this definition">¶</a></dt>
<dd><p>Run only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-s">
<span id="cmdoption--nocapture"></span><code class="descname">-s</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--nocapture</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-s" title="Permalink to this definition">¶</a></dt>
<dd><p>Don’t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--nologcapture">
<code class="descname">--nologcapture</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--nologcapture" title="Permalink to this definition">¶</a></dt>
<dd><p>Disable logging capture plugin. Logging configuration will be left intact. [NOSE_NOLOGCAPTURE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-format">
<code class="descname">--logging-format</code><code class="descclassname">=FORMAT</code><a class="headerlink" href="#cmdoption--logging-format" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify custom format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGFORMAT]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-datefmt">
<code class="descname">--logging-datefmt</code><code class="descclassname">=FORMAT</code><a class="headerlink" href="#cmdoption--logging-datefmt" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify custom date/time format to print statements. Uses the same format as used by standard logging handlers. [NOSE_LOGDATEFMT]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-filter">
<code class="descname">--logging-filter</code><code class="descclassname">=FILTER</code><a class="headerlink" href="#cmdoption--logging-filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify which statements to filter in/out. By default, everything is captured. If the output is too verbose,
use this option to filter out needless output.
Example: filter=foo will capture statements issued ONLY to
foo or foo.what.ever.sub but not foobar or other logger.
Specify multiple loggers with comma: filter=foo,bar,baz.
If any logger name is prefixed with a minus, eg filter=-foo,
it will be excluded rather than included. Default: exclude logging messages from nose itself (-nose). [NOSE_LOGFILTER]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-clear-handlers">
<code class="descname">--logging-clear-handlers</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--logging-clear-handlers" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all other logging handlers</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--logging-level">
<code class="descname">--logging-level</code><code class="descclassname">=DEFAULT</code><a class="headerlink" href="#cmdoption--logging-level" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the log level to capture</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-coverage">
<code class="descname">--with-coverage</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-coverage" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin Coverage:
Activate a coverage report using Ned Batchelder’s coverage module.
[NOSE_WITH_COVERAGE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-package">
<code class="descname">--cover-package</code><code class="descclassname">=PACKAGE</code><a class="headerlink" href="#cmdoption--cover-package" title="Permalink to this definition">¶</a></dt>
<dd><p>Restrict coverage output to selected packages [NOSE_COVER_PACKAGE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-erase">
<code class="descname">--cover-erase</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-erase" title="Permalink to this definition">¶</a></dt>
<dd><p>Erase previously collected coverage statistics before run</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-tests">
<code class="descname">--cover-tests</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-tests" title="Permalink to this definition">¶</a></dt>
<dd><p>Include test modules in coverage report [NOSE_COVER_TESTS]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-min-percentage">
<code class="descname">--cover-min-percentage</code><code class="descclassname">=DEFAULT</code><a class="headerlink" href="#cmdoption--cover-min-percentage" title="Permalink to this definition">¶</a></dt>
<dd><p>Minimum percentage of coverage for tests to pass [NOSE_COVER_MIN_PERCENTAGE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-inclusive">
<code class="descname">--cover-inclusive</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-inclusive" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-html">
<code class="descname">--cover-html</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-html" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce HTML coverage information</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-html-dir">
<code class="descname">--cover-html-dir</code><code class="descclassname">=DIR</code><a class="headerlink" href="#cmdoption--cover-html-dir" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce HTML coverage information in dir</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-branches">
<code class="descname">--cover-branches</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-branches" title="Permalink to this definition">¶</a></dt>
<dd><p>Include branch coverage in coverage report [NOSE_COVER_BRANCHES]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-xml">
<code class="descname">--cover-xml</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--cover-xml" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce XML coverage information</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--cover-xml-file">
<code class="descname">--cover-xml-file</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--cover-xml-file" title="Permalink to this definition">¶</a></dt>
<dd><p>Produce XML coverage information in file</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--pdb">
<code class="descname">--pdb</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--pdb" title="Permalink to this definition">¶</a></dt>
<dd><p>Drop into debugger on failures or errors</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--pdb-failures">
<code class="descname">--pdb-failures</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--pdb-failures" title="Permalink to this definition">¶</a></dt>
<dd><p>Drop into debugger on failures</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--pdb-errors">
<code class="descname">--pdb-errors</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--pdb-errors" title="Permalink to this definition">¶</a></dt>
<dd><p>Drop into debugger on errors</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--no-deprecated">
<code class="descname">--no-deprecated</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--no-deprecated" title="Permalink to this definition">¶</a></dt>
<dd><p>Disable special handling of DeprecatedTest exceptions.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-doctest">
<code class="descname">--with-doctest</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-doctest" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin Doctest:
Activate doctest plugin to find and run doctests in non-test modules.
[NOSE_WITH_DOCTEST]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--doctest-tests">
<code class="descname">--doctest-tests</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--doctest-tests" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--doctest-extension">
<code class="descname">--doctest-extension</code><code class="descclassname">=EXT</code><a class="headerlink" href="#cmdoption--doctest-extension" title="Permalink to this definition">¶</a></dt>
<dd><p>Also look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--doctest-result-variable">
<code class="descname">--doctest-result-variable</code><code class="descclassname">=VAR</code><a class="headerlink" href="#cmdoption--doctest-result-variable" title="Permalink to this definition">¶</a></dt>
<dd><p>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]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--doctest-fixtures">
<code class="descname">--doctest-fixtures</code><code class="descclassname">=SUFFIX</code><a class="headerlink" href="#cmdoption--doctest-fixtures" title="Permalink to this definition">¶</a></dt>
<dd><p>Find fixtures for a doctest file in module with this name appended to the base name of the doctest file</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--doctest-options">
<code class="descname">--doctest-options</code><code class="descclassname">=OPTIONS</code><a class="headerlink" href="#cmdoption--doctest-options" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify options to pass to doctest. Eg. ‘+ELLIPSIS,+NORMALIZE_WHITESPACE’</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-isolation">
<code class="descname">--with-isolation</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-isolation" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin IsolationPlugin:
Activate the isolation plugin to isolate changes to external
modules to a single test module or package. The isolation plugin
resets the contents of sys.modules after each test module or
package runs to its state before the test. PLEASE NOTE that this
plugin should not be used with the coverage plugin, or in any other case
where module reloading may produce undesirable side-effects.
[NOSE_WITH_ISOLATION]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption-d">
<span id="cmdoption--detailed-errors"></span><span id="cmdoption--failure-detail"></span><code class="descname">-d</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--detailed-errors</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--failure-detail</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-d" title="Permalink to this definition">¶</a></dt>
<dd><p>Add detail to error output by attempting to evaluate failed asserts [NOSE_DETAILED_ERRORS]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-profile">
<code class="descname">--with-profile</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-profile" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin Profile:
Use this plugin to run tests using the hotshot profiler.
[NOSE_WITH_PROFILE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--profile-sort">
<code class="descname">--profile-sort</code><code class="descclassname">=SORT</code><a class="headerlink" href="#cmdoption--profile-sort" title="Permalink to this definition">¶</a></dt>
<dd><p>Set sort order for profiler output</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--profile-stats-file">
<code class="descname">--profile-stats-file</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--profile-stats-file" title="Permalink to this definition">¶</a></dt>
<dd><p>Profiler stats file; default is a new temp file on each run</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--profile-restrict">
<code class="descname">--profile-restrict</code><code class="descclassname">=RESTRICT</code><a class="headerlink" href="#cmdoption--profile-restrict" title="Permalink to this definition">¶</a></dt>
<dd><p>Restrict profiler output. See help for pstats.Stats for details</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--no-skip">
<code class="descname">--no-skip</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--no-skip" title="Permalink to this definition">¶</a></dt>
<dd><p>Disable special handling of SkipTest exceptions.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-id">
<code class="descname">--with-id</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-id" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin TestId:
Activate to add a test id (like #1) to each test name output. Activate
with –failed to rerun failing tests only.
[NOSE_WITH_ID]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--id-file">
<code class="descname">--id-file</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--id-file" title="Permalink to this definition">¶</a></dt>
<dd><p>Store test ids found in test runs in this file. Default is the file .noseids in the working directory.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--failed">
<code class="descname">--failed</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--failed" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the tests that failed in the last test run.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--processes">
<code class="descname">--processes</code><code class="descclassname">=NUM</code><a class="headerlink" href="#cmdoption--processes" title="Permalink to this definition">¶</a></dt>
<dd><p>Spread test run among this many processes. Set a number equal to the number of processors or cores in your machine for best results. Pass a negative number to have the number of processes automatically set to the number of cores. Passing 0 means to disable parallel testing. Default is 0 unless NOSE_PROCESSES is set. [NOSE_PROCESSES]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--process-timeout">
<code class="descname">--process-timeout</code><code class="descclassname">=SECONDS</code><a class="headerlink" href="#cmdoption--process-timeout" title="Permalink to this definition">¶</a></dt>
<dd><p>Set timeout for return of results from each test runner process. Default is 10. [NOSE_PROCESS_TIMEOUT]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--process-restartworker">
<code class="descname">--process-restartworker</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--process-restartworker" title="Permalink to this definition">¶</a></dt>
<dd><p>If set, will restart each worker process once their tests are done, this helps control memory leaks from killing the system. [NOSE_PROCESS_RESTARTWORKER]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--with-xunit">
<code class="descname">--with-xunit</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--with-xunit" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--xunit-file">
<code class="descname">--xunit-file</code><code class="descclassname">=FILE</code><a class="headerlink" href="#cmdoption--xunit-file" title="Permalink to this definition">¶</a></dt>
<dd><p>Path to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--xunit-testsuite-name">
<code class="descname">--xunit-testsuite-name</code><code class="descclassname">=PACKAGE</code><a class="headerlink" href="#cmdoption--xunit-testsuite-name" title="Permalink to this definition">¶</a></dt>
<dd><p>Name of the testsuite in the xunit xml, generated by plugin. Default test suite name is nosetests.</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--all-modules">
<code class="descname">--all-modules</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--all-modules" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable plugin AllModules: Collect tests from all python modules.
[NOSE_ALL_MODULES]</p>
</dd></dl>
<dl class="cmdoption">
<dt id="cmdoption--collect-only">
<code class="descname">--collect-only</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--collect-only" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable collect-only:
Collect and output test names only, don’t run any tests.
[COLLECT_ONLY]</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Basic usage</a><ul>
<li><a class="reference internal" href="#extended-usage">Extended usage</a><ul>
<li><a class="reference internal" href="#selecting-tests">Selecting Tests</a></li>
<li><a class="reference internal" href="#configuration">Configuration</a></li>
<li><a class="reference internal" href="#using-plugins">Using Plugins</a></li>
<li><a class="reference internal" href="#plugins">0.9 plugins</a></li>
<li><a class="reference internal" href="#and-0-11-plugins">0.10 and 0.11 plugins</a></li>
<li><a class="reference internal" href="#options">Options</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="testing.html"
title="previous chapter">Testing with nose</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="writing_tests.html"
title="next chapter">Writing tests</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/usage.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="writing_tests.html" title="Writing tests"
>next</a> |</li>
<li class="right" >
<a href="testing.html" title="Testing with nose"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">nose 1.3.7 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="testing.html" >Testing with nose</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009, Jason Pellerin.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.5.
</div>
</body>
</html>
|