This file is indexed.

/usr/share/doc/python-nose2/html/usage.html is in python-nose2-doc 0.7.4-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
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Using nose2 &mdash; nose2 0.6.0 documentation</title>
  

  
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="nose2 0.6.0 documentation" href="index.html"/>
        <link rel="next" title="Configuring nose2" href="configuration.html"/>
        <link rel="prev" title="Getting started with nose2" href="getting_started.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> nose2
          

          
          </a>

          
            
            
              <div class="version">
                0.6
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting started with nose2</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Using nose2</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#naming-tests">Naming Tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#running-tests">Running Tests</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#specifying-tests-to-run">Specifying Tests to Run</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-tests-with-python-setup-py-test">Running Tests with <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#getting-help">Getting Help</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuring nose2</a></li>
<li class="toctree-l1"><a class="reference internal" href="differences.html">Differences: nose2 vs nose vs unittest2</a></li>
<li class="toctree-l1"><a class="reference internal" href="plugins.html">Plugins for nose2</a></li>
<li class="toctree-l1"><a class="reference internal" href="tools.html">Tools and Helpers</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dev/writing_plugins.html">Writing Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/documenting_plugins.html">Documenting plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/event_reference.html">Event reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/hook_reference.html">Hook reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/session_reference.html">Session reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/plugin_class_reference.html">Plugin class reference</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dev/contributing.html">Contributing to nose2</a></li>
<li class="toctree-l1"><a class="reference internal" href="dev/internals.html">Internals</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">nose2</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>Using nose2</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/usage.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="using-nose2">
<h1>Using nose2<a class="headerlink" href="#using-nose2" title="Permalink to this headline"></a></h1>
<div class="section" id="naming-tests">
<h2>Naming Tests<a class="headerlink" href="#naming-tests" title="Permalink to this headline"></a></h2>
<p>nose2 will look in each directory under the starting directory, unless
the configuration modifies the included paths. Within directories and
within any Python packages found in the starting directory and any
source directories in the starting directory, nose2 will discover
test modules and load tests from them. “Test modules” means any
modules whose names start with “test”. See the Configuration section
for ways to modify searching for tests.</p>
<p>Directories nose2 will look in:</p>
<ul class="simple">
<li>Directory that contains an <code class="docutils literal"><span class="pre">__init__.py</span></code> file (a Python package)</li>
<li>Directory name that contains “test” after being lowercased.</li>
<li>Directory name that is either <code class="docutils literal"><span class="pre">lib</span></code> or <code class="docutils literal"><span class="pre">src</span></code></li>
</ul>
<p>Each of the following test files will be run:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">test</span><span class="o">.</span><span class="n">py</span>
<span class="n">test_views</span><span class="o">.</span><span class="n">py</span>
<span class="n">test_models</span><span class="o">.</span><span class="n">py</span>
<span class="n">testThingy</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>These files will not be run:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">not_a_test</span><span class="o">.</span><span class="n">py</span>
<span class="n">myapp_test</span><span class="o">.</span><span class="n">py</span>
<span class="n">some_test_file</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>Within test modules, nose2 will load tests from
<code class="xref py py-class docutils literal"><span class="pre">unittest.TestCase</span></code> subclasses, and from test functions
(functions whose names begin with “test”).</p>
</div>
<div class="section" id="running-tests">
<h2>Running Tests<a class="headerlink" href="#running-tests" title="Permalink to this headline"></a></h2>
<p>In the simplest case, go to the directory that includes your project
source and run <code class="docutils literal"><span class="pre">nose2</span></code> there:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">nose2</span>
</pre></div>
</div>
<p>This will discover tests in packages and test directories under that
directory, load them, and run them, then output something like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">.............................................................................</span>
<span class="o">----------------------------------------------------------------------</span>
<span class="n">Ran</span> <span class="mi">77</span> <span class="n">tests</span> <span class="ow">in</span> <span class="mf">1.897</span><span class="n">s</span>

<span class="n">OK</span>
</pre></div>
</div>
<p>To change the place discovery starts, or to change the top-level
importable directory of the project, use the <a class="reference internal" href="#cmdoption-s"><code class="xref std std-option docutils literal"><span class="pre">-s</span></code></a> and
<a class="reference internal" href="#cmdoption-t"><code class="xref std std-option docutils literal"><span class="pre">-t</span></code></a> options.</p>
<dl class="cmdoption">
<dt id="cmdoption-s">
<code class="descname">-s</code><code class="descclassname"> START_DIR</code><code class="descclassname">, </code><code class="descname">--start-dir</code><code class="descclassname"> START_DIR</code><a class="headerlink" href="#cmdoption-s" title="Permalink to this definition"></a></dt>
<dd><p>Directory to start discovery. Defaults to the current working
directory. This directory is where nose2 will start looking for
tests.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption-t">
<code class="descname">-t</code><code class="descclassname"> TOP_LEVEL_DIRECTORY</code><code class="descclassname">, </code><code class="descname">--top-level-directory</code><code class="descclassname"> TOP_LEVEL_DIRECTORY</code><code class="descclassname">, </code><code class="descname">--project-directory</code><code class="descclassname"> TOP_LEVEL_DIRECTORY</code><a class="headerlink" href="#cmdoption-t" title="Permalink to this definition"></a></dt>
<dd><p>Top-level directory of the project. Defaults to the starting
directory. This is the directory containing importable modules and
packages, and is always prepended to <code class="docutils literal"><span class="pre">sys.path</span></code> before test discovery
begins.</p>
</dd></dl>

<div class="section" id="specifying-tests-to-run">
<h3>Specifying Tests to Run<a class="headerlink" href="#specifying-tests-to-run" title="Permalink to this headline"></a></h3>
<p>Pass <em>test names</em> to nose2 on the command line to run individual test
modules, classes, or tests.</p>
<p>A test name consists of a <em>python object part</em> and, for generator or
parameterized tests, an <em>argument part</em>. The <em>python object part</em> is a
dotted name, such as
<code class="docutils literal"><span class="pre">pkg1.tests.test_things.SomeTests.test_ok</span></code>. The argument
part is separated from the python object part by a colon (“:”) and
specifies the <em>index</em> of the generated test to select, <em>starting from
1</em>. For example, <code class="docutils literal"><span class="pre">pkg1.test.test_things.test_params_func:1</span></code> would
select the <em>first</em> test generated from the parameterized test
<code class="docutils literal"><span class="pre">test_params_func</span></code>.</p>
<p>Plugins may provide other means of test selection.</p>
</div>
<div class="section" id="running-tests-with-python-setup-py-test">
<h3>Running Tests with <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code><a class="headerlink" href="#running-tests-with-python-setup-py-test" title="Permalink to this headline"></a></h3>
<p>nose2 supports distribute/setuptools’ <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code>
standard for running tests. To use nose2 to run your package’s tests,
add the following to your setup.py:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="p">(</span><span class="o">...</span>
      <span class="n">test_suite</span><span class="o">=</span><span class="s1">&#39;nose2.collector.collector&#39;</span><span class="p">,</span>
      <span class="o">...</span>
      <span class="p">)</span>
</pre></div>
</div>
<p>(Not literally. Don’t put the ‘…’ parts in.)</p>
<p>Two warnings about running tests this way.</p>
<p>One: because the setuptools test command is limited, nose2 returns a “test
suite” that actually takes over the test running process completely,
bypassing the test result and test runner that call it. This may be
incompatible with some packages.</p>
<p>Two: because the command line arguments to the test command may not
match up properly with nose2’s arguments, the nose2 instance started
by the collector <em>does not accept any command line arguments</em>. This
means that it always runs all tests, and that you cannot configure
plugins on the command line when running tests this way. As a
workaround, when running under the test command, nose2 will read
configuration from <code class="docutils literal"><span class="pre">setup.cfg</span></code> if it is present, in addition to
<code class="docutils literal"><span class="pre">unittest.cfg</span></code> and <code class="docutils literal"><span class="pre">nose2.cfg</span></code>. This enables you to put
configuration specific to the setuptools test command in <code class="docutils literal"><span class="pre">setup.cfg</span></code>
– for instance to activate plugins that you would otherwise activate
via the command line.</p>
</div>
</div>
<div class="section" id="getting-help">
<h2>Getting Help<a class="headerlink" href="#getting-help" title="Permalink to this headline"></a></h2>
<p>Run:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">nose2</span> <span class="o">-</span><span class="n">h</span>
</pre></div>
</div>
<p>to get help for nose2 itself and all loaded plugins.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">usage</span><span class="p">:</span> <span class="n">nose2</span> <span class="p">[</span><span class="o">-</span><span class="n">s</span> <span class="n">START_DIR</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">t</span> <span class="n">TOP_LEVEL_DIRECTORY</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">config</span> <span class="p">[</span><span class="n">CONFIG</span><span class="p">]]</span>
             <span class="p">[</span><span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">user</span><span class="o">-</span><span class="n">config</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">plugins</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">verbose</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">quiet</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">B</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">D</span><span class="p">]</span>
             <span class="p">[</span><span class="o">--</span><span class="n">collect</span><span class="o">-</span><span class="n">only</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">log</span><span class="o">-</span><span class="n">capture</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">P</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span>
             <span class="p">[</span><span class="n">testNames</span> <span class="p">[</span><span class="n">testNames</span> <span class="o">...</span><span class="p">]]</span>

<span class="n">positional</span> <span class="n">arguments</span><span class="p">:</span>
  <span class="n">testNames</span>

<span class="n">optional</span> <span class="n">arguments</span><span class="p">:</span>
  <span class="o">-</span><span class="n">s</span> <span class="n">START_DIR</span><span class="p">,</span> <span class="o">--</span><span class="n">start</span><span class="o">-</span><span class="nb">dir</span> <span class="n">START_DIR</span>
                        <span class="n">Directory</span> <span class="n">to</span> <span class="n">start</span> <span class="n">discovery</span> <span class="p">(</span><span class="s1">&#39;.&#39;</span> <span class="n">default</span><span class="p">)</span>
  <span class="o">-</span><span class="n">t</span> <span class="n">TOP_LEVEL_DIRECTORY</span><span class="p">,</span> <span class="o">--</span><span class="n">top</span><span class="o">-</span><span class="n">level</span><span class="o">-</span><span class="n">directory</span> <span class="n">TOP_LEVEL_DIRECTORY</span><span class="p">,</span> <span class="o">--</span><span class="n">project</span><span class="o">-</span><span class="n">directory</span> <span class="n">TOP_LEVEL_DIRECTORY</span>
                        <span class="n">Top</span> <span class="n">level</span> <span class="n">directory</span> <span class="n">of</span> <span class="n">project</span> <span class="p">(</span><span class="n">defaults</span> <span class="n">to</span> <span class="n">start</span> <span class="nb">dir</span><span class="p">)</span>
  <span class="o">--</span><span class="n">config</span> <span class="p">[</span><span class="n">CONFIG</span><span class="p">],</span> <span class="o">-</span><span class="n">c</span> <span class="p">[</span><span class="n">CONFIG</span><span class="p">]</span>
                        <span class="n">Config</span> <span class="n">files</span> <span class="n">to</span> <span class="n">load</span><span class="p">,</span> <span class="k">if</span> <span class="n">they</span> <span class="n">exist</span><span class="o">.</span> <span class="p">(</span><span class="s1">&#39;unittest.cfg&#39;</span>
                        <span class="ow">and</span> <span class="s1">&#39;nose2.cfg&#39;</span> <span class="ow">in</span> <span class="n">start</span> <span class="n">directory</span> <span class="n">default</span><span class="p">)</span>
  <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">user</span><span class="o">-</span><span class="n">config</span>      <span class="n">Do</span> <span class="ow">not</span> <span class="n">load</span> <span class="n">user</span> <span class="n">config</span> <span class="n">files</span>
  <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">plugins</span>          <span class="n">Do</span> <span class="ow">not</span> <span class="n">load</span> <span class="nb">any</span> <span class="n">plugins</span><span class="o">.</span> <span class="ne">Warning</span><span class="p">:</span> <span class="n">nose2</span> <span class="n">does</span> <span class="ow">not</span> <span class="n">do</span>
                        <span class="n">anything</span> <span class="k">if</span> <span class="n">no</span> <span class="n">plugins</span> <span class="n">are</span> <span class="n">loaded</span>
  <span class="o">--</span><span class="n">verbose</span><span class="p">,</span> <span class="o">-</span><span class="n">v</span>
  <span class="o">--</span><span class="n">quiet</span>
  <span class="o">-</span><span class="n">h</span><span class="p">,</span> <span class="o">--</span><span class="n">help</span>            <span class="n">Show</span> <span class="n">this</span> <span class="n">help</span> <span class="n">message</span> <span class="ow">and</span> <span class="n">exit</span>

<span class="n">plugin</span> <span class="n">arguments</span><span class="p">:</span>
  <span class="n">Command</span><span class="o">-</span><span class="n">line</span> <span class="n">arguments</span> <span class="n">added</span> <span class="n">by</span> <span class="n">plugins</span><span class="p">:</span>

  <span class="o">-</span><span class="n">B</span><span class="p">,</span> <span class="o">--</span><span class="n">output</span><span class="o">-</span><span class="n">buffer</span>   <span class="n">Enable</span> <span class="n">output</span> <span class="n">buffer</span>
  <span class="o">-</span><span class="n">D</span><span class="p">,</span> <span class="o">--</span><span class="n">debugger</span>        <span class="n">Enter</span> <span class="n">pdb</span> <span class="n">on</span> <span class="n">test</span> <span class="n">fail</span> <span class="ow">or</span> <span class="n">error</span>
  <span class="o">--</span><span class="n">collect</span><span class="o">-</span><span class="n">only</span>        <span class="n">Collect</span> <span class="ow">and</span> <span class="n">output</span> <span class="n">test</span> <span class="n">names</span><span class="p">,</span> <span class="n">do</span> <span class="ow">not</span> <span class="n">run</span> <span class="nb">any</span> <span class="n">tests</span>
  <span class="o">--</span><span class="n">log</span><span class="o">-</span><span class="n">capture</span>         <span class="n">Enable</span> <span class="n">log</span> <span class="n">capture</span>
  <span class="o">-</span><span class="n">P</span><span class="p">,</span> <span class="o">--</span><span class="nb">print</span><span class="o">-</span><span class="n">hooks</span>     <span class="n">Print</span> <span class="n">names</span> <span class="n">of</span> <span class="n">hooks</span> <span class="ow">in</span> <span class="n">order</span> <span class="n">of</span> <span class="n">execution</span>
</pre></div>
</div>
</div>
</div>


           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="configuration.html" class="btn btn-neutral float-right" title="Configuring nose2" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="getting_started.html" class="btn btn-neutral" title="Getting started with nose2" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2018, Jason Pellerin.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'0.6.0',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </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>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>