py.test/pylib 1.3.2: API and reporting refinements, many fixes¶
The pylib/py.test 1.3.2 release brings many bug fixes and some new features. It was refined for and tested against the recently released Python2.7 and remains compatibile to the usual armada of interpreters (Python2.4 through to Python3.1.2, Jython and PyPy). Note that for using distributed testing features you’ll need to upgrade to the jointly released pytest-xdist-1.4 because of some internal refactorings.
See http://pytest.org for general documentation and below for a detailed CHANGELOG.
cheers & particular thanks to Benjamin Peterson, Ronny Pfannschmidt and all issue and patch contributors,
holger krekel
Changes between 1.3.1 and 1.3.2¶
New features¶
fix issue103: introduce py.test.raises as context manager, examples:
with py.test.raises(ZeroDivisionError): x = 0 1 / x with py.test.raises(RuntimeError) as excinfo: call_something() # you may do extra checks on excinfo.value|type|traceback here
(thanks Ronny Pfannschmidt)
Funcarg factories can now dynamically apply a marker to a test invocation. This is for example useful if a factory provides parameters to a test which are expected-to-fail:
def pytest_funcarg__arg(request): request.applymarker(py.test.mark.xfail(reason="flaky config")) ... def test_function(arg): ...
improved error reporting on collection and import errors. This makes use of a more general mechanism, namely that for custom test item/collect nodes
node.repr_failure(excinfo)is now uniformly called so that you can override it to return a string error representation of your choice which is going to be reported as a (red) string.introduce ‘–junitprefix=STR’ option to prepend a prefix to all reports in the junitxml file.
Bug fixes / Maintenance¶
- make tests and the
pytest_recwarnplugin in particular fully compatible to Python2.7 (if you use therecwarnfuncarg warnings will be enabled so that you can properly check for their existence in a cross-python manner). - refine –pdb: ignore xfailed tests, unify its TB-reporting and don’t display failures again at the end.
- fix assertion interpretation