-
Notifications
You must be signed in to change notification settings - Fork 0
/
pytest_plugin.html
281 lines (231 loc) · 15.9 KB
/
pytest_plugin.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PyTest plugin. — AnyPyTools 1.11.5 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/cloud.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/table_styling.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noticia+Text:400,i,b,bi|Open+Sans:400,i,b,bi|Roboto+Mono:400,i,b,bi&display=swap" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@jupyter-widgets/html-manager@^1.0.1/dist/embed-amd.js"></script>
<script src="_static/jquery.cookie.js"></script>
<script src="_static/cloud.base.js"></script>
<script src="_static/cloud.js"></script>
<link rel="shortcut icon" href="_static/anypytools.ico"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Developer’s Guide" href="devguide.html" />
<link rel="prev" title="anypytools.tools" href="api/tools.html" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head><body>
<div class="relbar-top">
<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="index.html" title="Table Of Contents"
accesskey="C">toc</a> </li>
<li class="right" >
<a href="devguide.html" title="Developer’s Guide"
accesskey="N">next</a> </li>
<li class="right" >
<a href="api/tools.html" title="anypytools.tools"
accesskey="P">previous</a> </li>
<li><a href="index.html">AnyPyTools 1.11.5 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">PyTest plugin.</a></li>
</ul>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="tex2jax_ignore mathjax_ignore section" id="pytest-plugin">
<h1>PyTest plugin.<a class="headerlink" href="#pytest-plugin" title="Permalink to this headline">¶</a></h1>
<p>Pytest is a fantastic test framework for Python code. AnyPyTools provides a
pytest plugin for running and testing AnyBody models. The plugin make pytest
collect and run AnyScript files with a <code class="docutils literal notranslate"><span class="pre">test_</span></code> prefix (e.g.
<code class="docutils literal notranslate"><span class="pre">test_mymodel.any</span></code>). Once loaded the plugin will attempt to execute a
<code class="docutils literal notranslate"><span class="pre">Main.RunTest</span></code> operation if it exists. If the models produce error while
loading and running, the framework considers it a failed test.</p>
<p>Created on Mon Sep 1 12:44:36 2014.</p>
<p>@author: Morten</p>
<dl class="py exception">
<dt>
<em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">AnyException</span></code><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyException"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Custom exception for error reporting.</p>
</dd></dl>
<dl class="py class">
<dt>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">AnyTestFile</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">k</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kw</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestFile"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>pytest.File subclass for AnyScript files.</p>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">collect</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestFile.collect"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Yield test cases from a AnyScript test file.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">AnyTestItem</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">k</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kw</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestItem"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>pytest.Item subclass representing individual collected tests.</p>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">reportinfo</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestItem.reportinfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">repr_failure</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">excinfo</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestItem.repr_failure"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Print a representation when a test failes.</p>
</dd></dl>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">runtest</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestItem.runtest"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Run an AnyScript test item.</p>
</dd></dl>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">save_output_files</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src_folder</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_folder</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">result</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hdf5files</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestItem.save_output_files"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Saves hdf5, macro, and log files from a test run
and copy it to the target_folder</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">AnyTestSession</span></code><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestSession"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Class for storing configuation of the AnyTest plugin to pytest.</p>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">configure</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#AnyTestSession.configure"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Configure the AnyTestSession object.</p>
<p>This can’t be in __init__()
since it is instantiated and added to the pytest namespace very
early in the pytest startup.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">DeferPlugin</span></code><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#DeferPlugin"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Simple plugin to defer pytest-xdist hook functions.</p>
<dl class="py method">
<dt>
<code class="sig-name descname"><span class="pre">pytest_xdist_setupnodes</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">specs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#DeferPlugin.pytest_xdist_setupnodes"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>called before any remote node is set up.</p>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt>
<code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">change_dir</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#change_dir"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Context manager for changing directories.</p>
</dd></dl>
<dl class="py function">
<dt>
<code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">pytest_collect_file</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parent</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#pytest_collect_file"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Collect AnyScript test files.</p>
</dd></dl>
<dl class="py function">
<dt>
<code class="sig-prename descclassname"><span class="pre">anypytools.pytest_plugin.</span></code><code class="sig-name descname"><span class="pre">pytest_configure</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/anypytools/pytest_plugin.html#pytest_configure"><span class="viewcode-link"><span class="pre">[source]</span></span></a></dt>
<dd><p>Configure the AnyTest framework.</p>
</dd></dl>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html" title="index">
<img class="logo" src="_static/anypytools_logo.png" alt="Logo"/>
</a></p>
<div class="sphinxprev">
<h4>Previous page</h4>
<p class="topless"><a href="api/tools.html"
title="Previous page">← anypytools.tools</a></p>
</div>
<div class="sphinxnext">
<h4>Next page</h4>
<p class="topless"><a href="devguide.html"
title="Next page">→ Developer’s Guide</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pytest_plugin.md.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="sidebar-toggle-group no-js">
<button class="sidebar-toggle" id="sidebar-hide" title="Hide the sidebar menu">
«
<span class="show-for-small">hide menu</span>
</button>
<button class="sidebar-toggle" id="sidebar-show" title="Show the sidebar menu">
<span class="show-for-small">menu</span>
<span class="hide-for-small">sidebar</span>
»
</button>
</div>
<div class="clearer"></div>
</div>
<div class="relbar-bottom">
<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="index.html" title="Table Of Contents"
>toc</a> </li>
<li class="right" >
<a href="devguide.html" title="Developer’s Guide"
>next</a> </li>
<li class="right" >
<a href="api/tools.html" title="anypytools.tools"
>previous</a> </li>
<li><a href="index.html">AnyPyTools 1.11.5 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">PyTest plugin.</a></li>
</ul>
</div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2021, Morten Enemark Lund.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.4.
</div>
<!-- cloud_sptheme 1.4 -->
</body>
</html>