/usr/share/doc/python-pytest-doc/html/announce/release-2.4.0.html is in python-pytest-doc 2.6.3-2.
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 | <!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>pytest-2.4.0: new fixture features/hooks and bug fixes</title>
<link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.6.2',
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="shortcut icon" href="../_static/pytest1favi.ico"/>
<link rel="top" title="None" href="../index.html" />
<link rel="up" title="Release announcements" href="index.html" />
<link rel="next" title="pytest-2.3.5: bug fixes and little improvements" href="release-2.3.5.html" />
<link rel="prev" title="pytest-2.4.1: fixing three regressions compared to 2.3.5" href="release-2.4.1.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="release-2.3.5.html" title="pytest-2.3.5: bug fixes and little improvements"
accesskey="N">next</a></li>
<li class="right" >
<a href="release-2.4.1.html" title="pytest-2.4.1: fixing three regressions compared to 2.3.5"
accesskey="P">previous</a> |</li>
<li><a href="../contents.html">pytest-2.6.2</a> »</li>
<li><a href="index.html" accesskey="U">Release announcements</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="pytest-2-4-0-new-fixture-features-hooks-and-bug-fixes">
<h1>pytest-2.4.0: new fixture features/hooks and bug fixes<a class="headerlink" href="#pytest-2-4-0-new-fixture-features-hooks-and-bug-fixes" title="Permalink to this headline">¶</a></h1>
<p>The just released pytest-2.4.0 brings many improvements and numerous
bug fixes while remaining plugin- and test-suite compatible apart
from a few supposedly very minor incompatibilities. See below for
a full list of details. A few feature highlights:</p>
<ul class="simple">
<li>new yield-style fixtures <a class="reference external" href="http://pytest.org/latest/yieldfixture.html">pytest.yield_fixture</a>, allowing to use
existing with-style context managers in fixture functions.</li>
<li>improved pdb support: <tt class="docutils literal"><span class="pre">import</span> <span class="pre">pdb</span> <span class="pre">;</span> <span class="pre">pdb.set_trace()</span></tt> now works
without requiring prior disabling of stdout/stderr capturing.
Also the <tt class="docutils literal"><span class="pre">--pdb</span></tt> options works now on collection and internal errors
and we introduced a new experimental hook for IDEs/plugins to
intercept debugging: <tt class="docutils literal"><span class="pre">pytest_exception_interact(node,</span> <span class="pre">call,</span> <span class="pre">report)</span></tt>.</li>
<li>shorter monkeypatch variant to allow specifying an import path as
a target, for example: <tt class="docutils literal"><span class="pre">monkeypatch.setattr("requests.get",</span> <span class="pre">myfunc)</span></tt></li>
<li>better unittest/nose compatibility: all teardown methods are now only
called if the corresponding setup method succeeded.</li>
<li>integrate tab-completion on command line options if you
have <a class="reference external" href="http://pypi.python.org/pypi/argcomplete">argcomplete</a>
configured.</li>
<li>allow boolean expression directly with skipif/xfail
if a “reason” is also specified.</li>
<li>a new hook <tt class="docutils literal"><span class="pre">pytest_load_initial_conftests</span></tt> allows plugins like
<a class="reference external" href="http://pypi.python.org/pypi/pytest-django">pytest-django</a> to
influence the environment before conftest files import <tt class="docutils literal"><span class="pre">django</span></tt>.</li>
<li>reporting: color the last line red or green depending if
failures/errors occured or everything passed.</li>
</ul>
<p>The documentation has been updated to accomodate the changes,
see <a class="reference external" href="http://pytest.org">http://pytest.org</a></p>
<p>To install or upgrade pytest:</p>
<div class="highlight-python"><div class="highlight"><pre>pip install -U pytest # or
easy_install -U pytest
</pre></div>
</div>
<p><strong>Many thanks to all who helped, including Floris Bruynooghe,
Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff,
Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian
Theunert and many others.</strong></p>
<p>may passing tests be with you,</p>
<p>holger krekel</p>
<div class="section" id="changes-between-2-3-5-and-2-4">
<h2>Changes between 2.3.5 and 2.4<a class="headerlink" href="#changes-between-2-3-5-and-2-4" title="Permalink to this headline">¶</a></h2>
<p>known incompatibilities:</p>
<ul class="simple">
<li>if calling –genscript from python2.7 or above, you only get a
standalone script which works on python2.7 or above. Use Python2.6
to also get a python2.5 compatible version.</li>
<li>all xunit-style teardown methods (nose-style, pytest-style,
unittest-style) will not be called if the corresponding setup method failed,
see issue322 below.</li>
<li>the pytest_plugin_unregister hook wasn’t ever properly called
and there is no known implementation of the hook - so it got removed.</li>
<li>pytest.fixture-decorated functions cannot be generators (i.e. use
yield) anymore. This change might be reversed in 2.4.1 if it causes
unforeseen real-life issues. However, you can always write and return
an inner function/generator and change the fixture consumer to iterate
over the returned generator. This change was done in lieu of the new
<tt class="docutils literal"><span class="pre">pytest.yield_fixture</span></tt> decorator, see below.</li>
</ul>
<p>new features:</p>
<ul>
<li><p class="first">experimentally introduce a new <tt class="docutils literal"><span class="pre">pytest.yield_fixture</span></tt> decorator
which accepts exactly the same parameters as pytest.fixture but
mandates a <tt class="docutils literal"><span class="pre">yield</span></tt> statement instead of a <tt class="docutils literal"><span class="pre">return</span> <span class="pre">statement</span></tt> from
fixture functions. This allows direct integration with “with-style”
context managers in fixture functions and generally avoids registering
of finalization callbacks in favour of treating the “after-yield” as
teardown code. Thanks Andreas Pelme, Vladimir Keleshev, Floris
Bruynooghe, Ronny Pfannschmidt and many others for discussions.</p>
</li>
<li><p class="first">allow boolean expression directly with skipif/xfail
if a “reason” is also specified. Rework skipping documentation
to recommend “condition as booleans” because it prevents surprises
when importing markers between modules. Specifying conditions
as strings will remain fully supported.</p>
</li>
<li><p class="first">reporting: color the last line red or green depending if
failures/errors occured or everything passed. thanks Christian
Theunert.</p>
</li>
<li><p class="first">make “import pdb ; pdb.set_trace()” work natively wrt capturing (no
“-s” needed anymore), making <tt class="docutils literal"><span class="pre">pytest.set_trace()</span></tt> a mere shortcut.</p>
</li>
<li><p class="first">fix issue181: –pdb now also works on collect errors (and
on internal errors) . This was implemented by a slight internal
refactoring and the introduction of a new hook
<tt class="docutils literal"><span class="pre">pytest_exception_interact</span></tt> hook (see next item).</p>
</li>
<li><p class="first">fix issue341: introduce new experimental hook for IDEs/terminals to
intercept debugging: <tt class="docutils literal"><span class="pre">pytest_exception_interact(node,</span> <span class="pre">call,</span> <span class="pre">report)</span></tt>.</p>
</li>
<li><p class="first">new monkeypatch.setattr() variant to provide a shorter
invocation for patching out classes/functions from modules:</p>
<blockquote>
<div><p>monkeypatch.setattr(“requests.get”, myfunc)</p>
</div></blockquote>
<p>will replace the “get” function of the “requests” module with <tt class="docutils literal"><span class="pre">myfunc</span></tt>.</p>
</li>
<li><p class="first">fix issue322: tearDownClass is not run if setUpClass failed. Thanks
Mathieu Agopian for the initial fix. Also make all of pytest/nose
finalizer mimick the same generic behaviour: if a setupX exists and
fails, don’t run teardownX. This internally introduces a new method
“node.addfinalizer()” helper which can only be called during the setup
phase of a node.</p>
</li>
<li><p class="first">simplify pytest.mark.parametrize() signature: allow to pass a
CSV-separated string to specify argnames. For example:
<tt class="docutils literal"><span class="pre">pytest.mark.parametrize("input,expected",</span> <span class="pre">[(1,2),</span> <span class="pre">(2,3)])</span></tt>
works as well as the previous:
<tt class="docutils literal"><span class="pre">pytest.mark.parametrize(("input",</span> <span class="pre">"expected"),</span> <span class="pre">...)</span></tt>.</p>
</li>
<li><p class="first">add support for setUpModule/tearDownModule detection, thanks Brian Okken.</p>
</li>
<li><p class="first">integrate tab-completion on options through use of “argcomplete”.
Thanks Anthon van der Neut for the PR.</p>
</li>
<li><p class="first">change option names to be hyphen-separated long options but keep the
old spelling backward compatible. py.test -h will only show the
hyphenated version, for example “–collect-only” but “–collectonly”
will remain valid as well (for backward-compat reasons). Many thanks to
Anthon van der Neut for the implementation and to Hynek Schlawack for
pushing us.</p>
</li>
<li><p class="first">fix issue 308 - allow to mark/xfail/skip individual parameter sets
when parametrizing. Thanks Brianna Laugher.</p>
</li>
<li><p class="first">call new experimental pytest_load_initial_conftests hook to allow
3rd party plugins to do something before a conftest is loaded.</p>
</li>
</ul>
<p>Bug fixes:</p>
<ul class="simple">
<li>fix issue358 - capturing options are now parsed more properly
by using a new parser.parse_known_args method.</li>
<li>pytest now uses argparse instead of optparse (thanks Anthon) which
means that “argparse” is added as a dependency if installing into python2.6
environments or below.</li>
<li>fix issue333: fix a case of bad unittest/pytest hook interaction.</li>
<li>PR27: correctly handle nose.SkipTest during collection. Thanks
Antonio Cuni, Ronny Pfannschmidt.</li>
<li>fix issue355: junitxml puts name=”pytest” attribute to testsuite tag.</li>
<li>fix issue336: autouse fixture in plugins should work again.</li>
<li>fix issue279: improve object comparisons on assertion failure
for standard datatypes and recognise collections.abc. Thanks to
Brianna Laugher and Mathieu Agopian.</li>
<li>fix issue317: assertion rewriter support for the is_package method</li>
<li>fix issue335: document py.code.ExceptionInfo() object returned
from pytest.raises(), thanks Mathieu Agopian.</li>
<li>remove implicit distribute_setup support from setup.py.</li>
<li>fix issue305: ignore any problems when writing pyc files.</li>
<li>SO-17664702: call fixture finalizers even if the fixture function
partially failed (finalizers would not always be called before)</li>
<li>fix issue320 - fix class scope for fixtures when mixed with
module-level functions. Thanks Anatloy Bubenkoff.</li>
<li>you can specify “-q” or “-qq” to get different levels of “quieter”
reporting (thanks Katarzyna Jachim)</li>
<li>fix issue300 - Fix order of conftest loading when starting py.test
in a subdirectory.</li>
<li>fix issue323 - sorting of many module-scoped arg parametrizations</li>
<li>make sessionfinish hooks execute with the same cwd-context as at
session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov)</li>
<li>fix issue316 - properly reference collection hooks in docs</li>
<li>fix issue 306 - cleanup of -k/-m options to only match markers/test
names/keywords respectively. Thanks Wouter van Ackooy.</li>
<li>improved doctest counting for doctests in python modules –
files without any doctest items will not show up anymore
and doctest examples are counted as separate test items.
thanks Danilo Bellini.</li>
<li>fix issue245 by depending on the released py-1.4.14
which fixes py.io.dupfile to work with files with no
mode. Thanks Jason R. Coombs.</li>
<li>fix junitxml generation when test output contains control characters,
addressing issue267, thanks Jaap Broekhuizen</li>
<li>fix issue338: honor –tb style for setup/teardown errors as well. Thanks Maho.</li>
<li>fix issue307 - use yaml.safe_load in example, thanks Mark Eichin.</li>
<li>better parametrize error messages, thanks Brianna Laugher</li>
<li>pytest_terminal_summary(terminalreporter) hooks can now use
”.section(title)” and ”.line(msg)” methods to print extra
information at the end of a test run.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../contents.html">
<img class="logo" src="../_static/pytest1.png" alt="Logo"/>
</a></p><h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../contents.html">Contents</a></li>
<li><a href="../getting-started.html">Install</a></li>
<li><a href="../example/index.html">Examples</a></li>
<li><a href="../customize.html">Customize</a></li>
<li><a href="../contact.html">Contact</a></li>
<li><a href="../talks.html">Talks/Posts</a></li>
<li><a href="../changelog.html">Changelog</a></li>
</ul>
<hr>
<ul>
<li><a class="reference internal" href="#">pytest-2.4.0: new fixture features/hooks and bug fixes</a><ul>
<li><a class="reference internal" href="#changes-between-2-3-5-and-2-4">Changes between 2.3.5 and 2.4</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
<li><a href="../contents.html">Documentation overview</a><ul>
<li><a href="index.html">Release announcements</a><ul>
<li>Previous: <a href="release-2.4.1.html" title="previous chapter">pytest-2.4.1: fixing three regressions compared to 2.3.5</a></li>
<li>Next: <a href="release-2.3.5.html" title="next chapter">pytest-2.3.5: bug fixes and little improvements</a></li>
</ul></li>
</ul></li>
</ul><h3>Useful Links</h3>
<ul>
<li><a href="../index.html">The pytest Website</a></li>
<li><a href="../contributing.html">Contribution Guide</a></li>
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
<li><a href="https://bitbucket.org/hpk42/pytest/">pytest @ Bitbucket</a></li>
<li><a href="http://pytest.org/latest/plugins_index/index.html">3rd party plugins</a></li>
<li><a href="https://bitbucket.org/hpk42/pytest/issues?status=new&status=open">Issue Tracker</a></li>
<li><a href="http://pytest.org/latest/pytest.pdf">PDF Documentation</a>
</ul>
<div id="searchbox" style="display: none">
<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="footer">
© Copyright 2014, holger krekel.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>
|