finalizing docs

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-07-08 15:28:54 +02:00
parent 86440b1853
commit 9d47521cf0
3 changed files with 30 additions and 25 deletions

View File

@ -1,4 +1,4 @@
Changes between 1.3.1 and 1.3.2a Changes between 1.3.1 and 1.3.2
================================================== ==================================================
New features New features
@ -18,8 +18,8 @@ New features
(thanks Ronny Pfannschmidt) (thanks Ronny Pfannschmidt)
- Funcarg factories can now dynamically apply a marker to a - Funcarg factories can now dynamically apply a marker to a
test invocation. This is for example useful if a factory test invocation. This is for example useful if a factory
provides parameters to a test which are expected-to-fail: provides parameters to a test which are expected-to-fail::
def pytest_funcarg__arg(request): def pytest_funcarg__arg(request):
request.applymarker(py.test.mark.xfail(reason="flaky config")) request.applymarker(py.test.mark.xfail(reason="flaky config"))
@ -28,9 +28,9 @@ New features
def test_function(arg): def test_function(arg):
... ...
- improved error reporting when collection errors appear. - improved error reporting on collection and import errors. This makes
In general, for custom (test and particularly collection) use of a more general mechanism, namely that for custom test item/collect
nodes ``node.repr_failure(excinfo)`` is now called so that you can nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can
override it to return a string error representation of your choice override it to return a string error representation of your choice
which is going to be reported as a (red) string. which is going to be reported as a (red) string.
@ -40,11 +40,9 @@ New features
Bug fixes / Maintenance Bug fixes / Maintenance
++++++++++++++++++++++++++ ++++++++++++++++++++++++++
- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible - make tests and the ``pytest_recwarn`` plugin in particular fully compatible
to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that
you can properly check for their existence in a cross-python manner). you can properly check for their existence in a cross-python manner).
- improve error messages if importing a test module failed (ImportError,
import file mismatches, syntax errors)
- refine --pdb: ignore xfailed tests, unify its TB-reporting and - refine --pdb: ignore xfailed tests, unify its TB-reporting and
don't display failures again at the end. don't display failures again at the end.
- fix assertion interpretation with the ** operator (thanks Benjamin Peterson) - fix assertion interpretation with the ** operator (thanks Benjamin Peterson)

View File

@ -1,9 +1,9 @@
py.test/pylib 1.3.2: API and reporting refinements, many fixes 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 a few new The pylib/py.test 1.3.2 release brings many bug fixes and some new
features and was refined for and tested against the recently released features. It was refined for and tested against the recently released
Python2.7 besides remaining compatibile to the usual armada of interpreters 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 (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 distributed testing features you'll need to upgrade to the jointly released
pytest-xdist-1.4 because of some internal refactorings. pytest-xdist-1.4 because of some internal refactorings.
@ -16,7 +16,6 @@ and all issue and patch contributors,
holger krekel holger krekel
Changes between 1.3.1 and 1.3.2 Changes between 1.3.1 and 1.3.2
================================================== ==================================================
@ -37,8 +36,8 @@ New features
(thanks Ronny Pfannschmidt) (thanks Ronny Pfannschmidt)
- Funcarg factories can now dynamically apply a marker to a - Funcarg factories can now dynamically apply a marker to a
test invocation. This is for example useful if a factory test invocation. This is for example useful if a factory
provides parameters to a test which are expected-to-fail: provides parameters to a test which are expected-to-fail::
def pytest_funcarg__arg(request): def pytest_funcarg__arg(request):
request.applymarker(py.test.mark.xfail(reason="flaky config")) request.applymarker(py.test.mark.xfail(reason="flaky config"))
@ -47,9 +46,9 @@ New features
def test_function(arg): def test_function(arg):
... ...
- improved error reporting when collection errors appear. - improved error reporting on collection and import errors. This makes
In general, for custom (test and particularly collection) use of a more general mechanism, namely that for custom test item/collect
nodes ``node.repr_failure(excinfo)`` is now called so that you can nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can
override it to return a string error representation of your choice override it to return a string error representation of your choice
which is going to be reported as a (red) string. which is going to be reported as a (red) string.
@ -59,11 +58,9 @@ New features
Bug fixes / Maintenance Bug fixes / Maintenance
++++++++++++++++++++++++++ ++++++++++++++++++++++++++
- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible - make tests and the ``pytest_recwarn`` plugin in particular fully compatible
to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that
you can properly check for their existence in a cross-python manner). you can properly check for their existence in a cross-python manner).
- improve error messages if importing a test module failed (ImportError,
import file mismatches, syntax errors)
- refine --pdb: ignore xfailed tests, unify its TB-reporting and - refine --pdb: ignore xfailed tests, unify its TB-reporting and
don't display failures again at the end. don't display failures again at the end.
- fix assertion interpretation with the ** operator (thanks Benjamin Peterson) - fix assertion interpretation with the ** operator (thanks Benjamin Peterson)
@ -91,6 +88,8 @@ Bug fixes / Maintenance
- perform distributed testing related reporting in the xdist-plugin - perform distributed testing related reporting in the xdist-plugin
rather than having dist-related code in the generic py.test rather than having dist-related code in the generic py.test
distribution distribution
- fix homedir detection on Windows
- ship distribute_setup.py version 0.6.13
Changes between 1.3.0 and 1.3.1 Changes between 1.3.0 and 1.3.1
================================================== ==================================================

View File

@ -131,12 +131,16 @@ asserting expected exceptions
---------------------------------------- ----------------------------------------
In order to write assertions about exceptions, you can use In order to write assertions about exceptions, you can use
``py.test.raises`` as a context manager like this:: ``py.test.raises`` as a context manager like this:
.. sourcecode:: python
with py.test.raises(ZeroDivisionError): with py.test.raises(ZeroDivisionError):
1 / 0 1 / 0
and if you need to have access to the actual exception info you may use:: and if you need to have access to the actual exception info you may use:
.. sourcecode:: python
with py.test.raises(RuntimeError) as excinfo: with py.test.raises(RuntimeError) as excinfo:
def f(): def f():
@ -146,7 +150,9 @@ and if you need to have access to the actual exception info you may use::
# do checks related to excinfo.type, excinfo.value, excinfo.traceback # do checks related to excinfo.type, excinfo.value, excinfo.traceback
If you want to write test code that works on Python2.4 as well, If you want to write test code that works on Python2.4 as well,
you may also use two other ways to test for an expected exception:: you may also use two other ways to test for an expected exception:
.. sourcecode:: python
py.test.raises(ExpectedException, func, *args, **kwargs) py.test.raises(ExpectedException, func, *args, **kwargs)
py.test.raises(ExpectedException, "func(*args, **kwargs)") py.test.raises(ExpectedException, "func(*args, **kwargs)")
@ -217,7 +223,9 @@ keyword.
By default, all filename parts and By default, all filename parts and
class/function names of a test function are put into the set class/function names of a test function are put into the set
of keywords for a given test. You can specify additional of keywords for a given test. You can specify additional
kewords like this:: kewords like this:
.. sourcecode:: python
@py.test.mark.webtest @py.test.mark.webtest
def test_send_http(): def test_send_http():