Fix typo and add suggestion from review
This commit is contained in:
parent
afe847ecdc
commit
f2ba8d70b9
|
@ -321,7 +321,8 @@ Here's the ``smtp`` fixture changed to use ``addfinalizer`` for cleanup:
|
||||||
request.addfinalizer(fin)
|
request.addfinalizer(fin)
|
||||||
return smtp # provide the fixture value
|
return smtp # provide the fixture value
|
||||||
|
|
||||||
Both ``yield`` and ``addfinalizer`` methods work similar by calling their code after the test
|
|
||||||
|
Both ``yield`` and ``addfinalizer`` methods work similarly by calling their code after the test
|
||||||
ends, but ``addfinalizer`` has two key differences over ``yield``:
|
ends, but ``addfinalizer`` has two key differences over ``yield``:
|
||||||
|
|
||||||
1. It is possible to register multiple finalizer functions.
|
1. It is possible to register multiple finalizer functions.
|
||||||
|
@ -340,7 +341,8 @@ ends, but ``addfinalizer`` has two key differences over ``yield``:
|
||||||
return r
|
return r
|
||||||
|
|
||||||
In the example above, if ``"C28"`` fails with an exception, ``"C1"`` and ``"C3"`` will still
|
In the example above, if ``"C28"`` fails with an exception, ``"C1"`` and ``"C3"`` will still
|
||||||
be properly closed.
|
be properly closed. Of course, if an exception happens before the finalize function is
|
||||||
|
registered then it will not be executed.
|
||||||
|
|
||||||
|
|
||||||
.. _`request-context`:
|
.. _`request-context`:
|
||||||
|
|
Loading…
Reference in New Issue