summaryrefslogtreecommitdiff
path: root/doc/module_nose.loader.html
blob: 0dada1397b616fe92398f9932e15fd9db8a0dc2e (plain)
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
<html>
  <head>
    <title>nose: nose.loader</title>
    <link rel="stylesheet" href="site.css" type="text/css"></link>
  </head>
  <body>
    
    <div id="menu">
      <p>This document covers nose version <b>0.10.0a1</b></p>
      <h2>Documentation</h2><ul><li><a href="writing_plugins.html">Writing Plugins</a></li><li><a href="errorclassplugin.html">ErrorClass Plugins</a></li><li><a href="plugin_interface.html">Plugin Interface</a></li><li><a href="plugin_attrib.html">Builtin Plugin: attrib</a></li><li><a href="plugin_capture.html">Builtin Plugin: capture</a></li><li><a href="plugin_cover.html">Builtin Plugin: cover</a></li><li><a href="plugin_debug.html">Builtin Plugin: debug</a></li><li><a href="plugin_deprecated.html">Builtin Plugin: deprecated</a></li><li><a href="plugin_doctests.html">Builtin Plugin: doctests</a></li><li><a href="plugin_isolate.html">Builtin Plugin: isolate</a></li><li><a href="plugin_failuredetail.html">Builtin Plugin: failuredetail</a></li><li><a href="plugin_prof.html">Builtin Plugin: prof</a></li><li><a href="plugin_skip.html">Builtin Plugin: skip</a></li><li><a href="plugin_testid.html">Builtin Plugin: testid</a></li><li><a href="module_nose.loader.html">Module: nose.loader</a></li><li><a href="module_nose.result.html">Module: nose.result</a></li><li><a href="module_nose.inspector.html">Module: nose.inspector</a></li><li><a href="module_nose.tools.html">Module: nose.tools</a></li><li><a href="module_nose.importer.html">Module: nose.importer</a></li><li><a href="module_nose.suite.html">Module: nose.suite</a></li><li><a href="module_nose.config.html">Module: nose.config</a></li><li><a href="module_nose.core.html">Module: nose.core</a></li><li><a href="module_nose.twistedtools.html">Module: nose.twistedtools</a></li><li><a href="module_nose.util.html">Module: nose.util</a></li><li><a href="module_nose.proxy.html">Module: nose.proxy</a></li><li><a href="module_nose.selector.html">Module: nose.selector</a></li><li><a href="module_nose.case.html">Module: nose.case</a></li><li><a href="module_nose.commands.html">Module: nose.commands</a></li><li><a href="module_nose.exc.html">Module: nose.exc</a></li><li><a href="module_nose.plugins.manager.html">Module: nose.plugins.manager</a></li></ul>
      <p>Last update: <b>Mon Jun 25 23:50:58 2007</b></p>
    </div>
    
    <div id="main">
      <h1>nose: nose.loader</h1>
      
      <p>nose's test loader implements the same basic functionality as its
superclass, unittest.TestLoader, but extends it by more liberal
interpretations of what may be a test and how a test may be named.</p>
<h2>Classes</h2>
<div class="cls section"><span class="cls name">TestLoader</span><div class="cls doc"><p>Test loader that extends unittest.TestLoader to:</p>
<ul class="simple">
<li>Load tests from test-like functions and classes that are not
unittest.TestCase subclasses</li>
<li>Find and load test modules in a directory</li>
<li>Support tests that are generators</li>
<li>Support easy extensions of or changes to that behavior through plugins</li>
</ul>
<h4>Methods</h4><div class="method section"><span class="method name">__init__</span><span class="method args">(self, config=None, importer=None, workingDir=None, selector=None)</span><div class="method doc"><p>Initialize a test loader.</p>
<p>Parameters (all optional):</p>
<ul>
<li><p class="first">config: provide a <cite>nose.config.Config</cite> or other config class
instance; if not provided a <cite>nose.config.Config</cite> with
default values is used.</p>
</li>
<li><p class="first">importer: provide an importer instance that implenents
<cite>importFromPath</cite>. If not provided, a
<cite>nose.importer.Importer</cite> is used.</p>
</li>
<li><p class="first">workingDir: the directory to which file and module names are
relative. If not provided, assumed to be the current working
directory.</p>
</li>
<li><p class="first">selector: a selector class. If not provided, a
<a href="#id1" name="id2"><span class="problematic" id="id2">`</span></a>nose.selector.Selector1 is used.</p>
<div class="system-message" id="id1">
<p class="system-message-title">System Message: <a name="id1">WARNING/2</a> (<tt class="docutils">&lt;string&gt;</tt>, line 14); <em><a href="#id2">backlink</a></em></p>
<p>Inline interpreted text or phrase reference start-string without end-string.</p>
</div>
</li>
</ul>
</div></div><div class="method section"><span class="method name">getTestCaseNames</span><span class="method args">(self, testCaseClass)</span><div class="method doc"><p>Override to select with selector, unless
config.getTestCaseNames.Compat is True</p>
</div></div><div class="method section"><span class="method name">loadTestsFromDir</span><span class="method args">(self, path)</span><div class="method doc"><p>Load tests from the directory at path. This is a generator
-- each suite of tests from a module or other file is yielded
and is expected to be executed before the next file is
examined.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromFile</span><span class="method args">(self, filename)</span><div class="method doc"><p>Load tests from a non-module file. Default is to raise a
ValueError; plugins may implement <cite>loadTestsFromFile</cite> to
provide a list of tests loaded from the file.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromGenerator</span><span class="method args">(self, generator, module)</span><div class="method doc"><p>Lazy-load tests from a generator function. The generator function
may yield either:</p>
<ul class="simple">
<li>a callable, or</li>
<li>a function name resolvable within the same module</li>
</ul>
</div></div><div class="method section"><span class="method name">loadTestsFromGeneratorMethod</span><span class="method args">(self, generator, cls)</span><div class="method doc"><p>Lazy-load tests from a generator method.</p>
<p>This is more complicated than loading from a generator function,
since a generator method may yield:</p>
<ul class="simple">
<li>a function</li>
<li>a bound or unbound method, or</li>
<li>a method name</li>
</ul>
</div></div><div class="method section"><span class="method name">loadTestsFromModule</span><span class="method args">(self, module, discovered=False)</span><div class="method doc"><p>Load all tests from module and return a suite containing
them. If the module has been discovered and is not test-like,
the suite will be empty by default, though plugins may add
their own tests.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromName</span><span class="method args">(self, name, module=None, discovered=False)</span><div class="method doc"><p>Load tests from the entity with the given name.</p>
<p>The name may indicate a file, directory, module, or any object
within a module. See <cite>nose.util.split_test_name</cite> for details on
test name parsing.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromNames</span><span class="method args">(self, names, module=None)</span><div class="method doc"><p>Load tests from all names, returning a suite containing all
tests.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromTestCase</span><span class="method args">(self, testCaseClass)</span><span class="method inherited">(FIXME: inherited)</span><div class="method doc"><p>Return a suite of all tests cases contained in testCaseClass</p>
</div></div><div class="method section"><span class="method name">loadTestsFromTestClass</span><span class="method args">(self, cls)</span><div class="method doc"><p>Load tests from a test class that is <em>not</em> a unittest.TestCase
subclass.</p>
<p>In this case, we can't depend on the class's <cite>__init__</cite> taking method
name arguments, so we have to compose a MethodTestCase for each
method in the class that looks testlike.</p>
</div></div><div class="method section"><span class="method name">makeTest</span><span class="method args">(self, obj, parent=None)</span><div class="method doc"><p>Given a test object and its parent, return a test case
or test suite.</p>
</div></div><div class="method section"><span class="method name">resolve</span><span class="method args">(self, name, module)</span><div class="method doc"><p>Resolve name within module</p>
</div></div><div class="method section"><span class="method name">sortTestMethodsUsing</span><span class="method args">(...)</span><span class="method inherited">(FIXME: inherited)</span><div class="method doc"><p>cmp(x, y) -&gt; integer</p>
<p>Return negative if x&lt;y, zero if x==y, positive if x&gt;y.</p>
</div></div><h4>Attributes</h4><div class="attr section"><span class="attr name">testMethodPrefix</span><span class="attr value">test</span><div class="attr doc"></div></div></div></div>
<div class="cls section"><span class="cls name">defaultTestLoader</span><div class="cls doc"><p>Test loader that extends unittest.TestLoader to:</p>
<ul class="simple">
<li>Load tests from test-like functions and classes that are not
unittest.TestCase subclasses</li>
<li>Find and load test modules in a directory</li>
<li>Support tests that are generators</li>
<li>Support easy extensions of or changes to that behavior through plugins</li>
</ul>
<h4>Methods</h4><div class="method section"><span class="method name">__init__</span><span class="method args">(self, config=None, importer=None, workingDir=None, selector=None)</span><div class="method doc"><p>Initialize a test loader.</p>
<p>Parameters (all optional):</p>
<ul>
<li><p class="first">config: provide a <cite>nose.config.Config</cite> or other config class
instance; if not provided a <cite>nose.config.Config</cite> with
default values is used.</p>
</li>
<li><p class="first">importer: provide an importer instance that implenents
<cite>importFromPath</cite>. If not provided, a
<cite>nose.importer.Importer</cite> is used.</p>
</li>
<li><p class="first">workingDir: the directory to which file and module names are
relative. If not provided, assumed to be the current working
directory.</p>
</li>
<li><p class="first">selector: a selector class. If not provided, a
<a href="#id1" name="id2"><span class="problematic" id="id2">`</span></a>nose.selector.Selector1 is used.</p>
<div class="system-message" id="id1">
<p class="system-message-title">System Message: <a name="id1">WARNING/2</a> (<tt class="docutils">&lt;string&gt;</tt>, line 14); <em><a href="#id2">backlink</a></em></p>
<p>Inline interpreted text or phrase reference start-string without end-string.</p>
</div>
</li>
</ul>
</div></div><div class="method section"><span class="method name">getTestCaseNames</span><span class="method args">(self, testCaseClass)</span><div class="method doc"><p>Override to select with selector, unless
config.getTestCaseNames.Compat is True</p>
</div></div><div class="method section"><span class="method name">loadTestsFromDir</span><span class="method args">(self, path)</span><div class="method doc"><p>Load tests from the directory at path. This is a generator
-- each suite of tests from a module or other file is yielded
and is expected to be executed before the next file is
examined.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromFile</span><span class="method args">(self, filename)</span><div class="method doc"><p>Load tests from a non-module file. Default is to raise a
ValueError; plugins may implement <cite>loadTestsFromFile</cite> to
provide a list of tests loaded from the file.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromGenerator</span><span class="method args">(self, generator, module)</span><div class="method doc"><p>Lazy-load tests from a generator function. The generator function
may yield either:</p>
<ul class="simple">
<li>a callable, or</li>
<li>a function name resolvable within the same module</li>
</ul>
</div></div><div class="method section"><span class="method name">loadTestsFromGeneratorMethod</span><span class="method args">(self, generator, cls)</span><div class="method doc"><p>Lazy-load tests from a generator method.</p>
<p>This is more complicated than loading from a generator function,
since a generator method may yield:</p>
<ul class="simple">
<li>a function</li>
<li>a bound or unbound method, or</li>
<li>a method name</li>
</ul>
</div></div><div class="method section"><span class="method name">loadTestsFromModule</span><span class="method args">(self, module, discovered=False)</span><div class="method doc"><p>Load all tests from module and return a suite containing
them. If the module has been discovered and is not test-like,
the suite will be empty by default, though plugins may add
their own tests.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromName</span><span class="method args">(self, name, module=None, discovered=False)</span><div class="method doc"><p>Load tests from the entity with the given name.</p>
<p>The name may indicate a file, directory, module, or any object
within a module. See <cite>nose.util.split_test_name</cite> for details on
test name parsing.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromNames</span><span class="method args">(self, names, module=None)</span><div class="method doc"><p>Load tests from all names, returning a suite containing all
tests.</p>
</div></div><div class="method section"><span class="method name">loadTestsFromTestCase</span><span class="method args">(self, testCaseClass)</span><span class="method inherited">(FIXME: inherited)</span><div class="method doc"><p>Return a suite of all tests cases contained in testCaseClass</p>
</div></div><div class="method section"><span class="method name">loadTestsFromTestClass</span><span class="method args">(self, cls)</span><div class="method doc"><p>Load tests from a test class that is <em>not</em> a unittest.TestCase
subclass.</p>
<p>In this case, we can't depend on the class's <cite>__init__</cite> taking method
name arguments, so we have to compose a MethodTestCase for each
method in the class that looks testlike.</p>
</div></div><div class="method section"><span class="method name">makeTest</span><span class="method args">(self, obj, parent=None)</span><div class="method doc"><p>Given a test object and its parent, return a test case
or test suite.</p>
</div></div><div class="method section"><span class="method name">resolve</span><span class="method args">(self, name, module)</span><div class="method doc"><p>Resolve name within module</p>
</div></div><div class="method section"><span class="method name">sortTestMethodsUsing</span><span class="method args">(...)</span><span class="method inherited">(FIXME: inherited)</span><div class="method doc"><p>cmp(x, y) -&gt; integer</p>
<p>Return negative if x&lt;y, zero if x==y, positive if x&gt;y.</p>
</div></div><h4>Attributes</h4><div class="attr section"><span class="attr name">testMethodPrefix</span><span class="attr value">test</span><div class="attr doc"></div></div></div></div>

    </div>
  </body>
</html>