Merge pull request #7349 from tbm/doc
This commit is contained in:
commit
0821c5c81d
|
@ -98,7 +98,7 @@ and if you need to have access to the actual exception info you may use:
|
|||
f()
|
||||
assert "maximum recursion" in str(excinfo.value)
|
||||
|
||||
``excinfo`` is a ``ExceptionInfo`` instance, which is a wrapper around
|
||||
``excinfo`` is an ``ExceptionInfo`` instance, which is a wrapper around
|
||||
the actual exception raised. The main attributes of interest are
|
||||
``.type``, ``.value`` and ``.traceback``.
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ In the failure traceback we see that the test function was called with a
|
|||
function. The test function fails on our deliberate ``assert 0``. Here is
|
||||
the exact protocol used by ``pytest`` to call the test function this way:
|
||||
|
||||
1. pytest :ref:`finds <test discovery>` the ``test_ehlo`` because
|
||||
1. pytest :ref:`finds <test discovery>` the test ``test_ehlo`` because
|
||||
of the ``test_`` prefix. The test function needs a function argument
|
||||
named ``smtp_connection``. A matching fixture function is discovered by
|
||||
looking for a fixture-marked function named ``smtp_connection``.
|
||||
|
@ -859,7 +859,7 @@ be used with ``-k`` to select specific cases to run, and they will
|
|||
also identify the specific case when one is failing. Running pytest
|
||||
with ``--collect-only`` will show the generated IDs.
|
||||
|
||||
Numbers, strings, booleans and None will have their usual string
|
||||
Numbers, strings, booleans and ``None`` will have their usual string
|
||||
representation used in the test ID. For other objects, pytest will
|
||||
make a string based on the argument name. It is possible to customise
|
||||
the string used in a test ID for a certain fixture value by using the
|
||||
|
@ -898,7 +898,7 @@ the string used in a test ID for a certain fixture value by using the
|
|||
The above shows how ``ids`` can be either a list of strings to use or
|
||||
a function which will be called with the fixture value and then
|
||||
has to return a string to use. In the latter case if the function
|
||||
return ``None`` then pytest's auto-generated ID will be used.
|
||||
returns ``None`` then pytest's auto-generated ID will be used.
|
||||
|
||||
Running the above tests results in the following test IDs being used:
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ Let's run this:
|
|||
======================= 2 passed, 1 xfailed in 0.12s =======================
|
||||
|
||||
The one parameter set which caused a failure previously now
|
||||
shows up as an "xfailed (expected to fail)" test.
|
||||
shows up as an "xfailed" (expected to fail) test.
|
||||
|
||||
In case the values provided to ``parametrize`` result in an empty list - for
|
||||
example, if they're dynamically generated by some function - the behaviour of
|
||||
|
|
Loading…
Reference in New Issue