merge pass remove
This commit is contained in:
parent
803c536ca4
commit
b61b6138ec
|
@ -732,6 +732,12 @@ Here's how the previous example would look using the ``addfinalizer`` method:
|
||||||
It's a bit longer than yield fixtures and a bit more complex, but it
|
It's a bit longer than yield fixtures and a bit more complex, but it
|
||||||
does offer some nuances for when you're in a pinch.
|
does offer some nuances for when you're in a pinch.
|
||||||
|
|
||||||
|
.. code-block:: pytest
|
||||||
|
|
||||||
|
$ pytest -q test_emaillib.py
|
||||||
|
. [100%]
|
||||||
|
1 passed in 0.12s
|
||||||
|
|
||||||
Note on finalizer order
|
Note on finalizer order
|
||||||
""""""""""""""""""""""""
|
""""""""""""""""""""""""
|
||||||
|
|
||||||
|
@ -743,29 +749,25 @@ Consider the differences in the following examples:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fix_w_finalizers(request):
|
def test_bar(fix_w_yield1, fix_w_yield2):
|
||||||
request.addfinalizer(partial(print, "finalizer_2"))
|
print("test_bar")
|
||||||
request.addfinalizer(partial(print, "finalizer_1"))
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fix_w_yield():
|
def fix_w_yield1():
|
||||||
yield
|
yield
|
||||||
print("after_yield_1")
|
print("after_yield_1")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def fix_w_yield2():
|
||||||
|
yield
|
||||||
print("after_yield_2")
|
print("after_yield_2")
|
||||||
|
|
||||||
|
|
||||||
def test_foo(fix_w_finalizers):
|
|
||||||
print("test_foo")
|
|
||||||
|
|
||||||
|
|
||||||
def test_bar(fix_w_yield):
|
|
||||||
print("test_bar")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: pytest
|
.. code-block:: pytest
|
||||||
|
@ -785,11 +787,7 @@ Consider the differences in the following examples:
|
||||||
after_yield_2
|
after_yield_2
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: pytest
|
|
||||||
|
|
||||||
$ pytest -q test_emaillib.py
|
|
||||||
. [100%]
|
|
||||||
1 passed in 0.12s
|
|
||||||
.. _`safe teardowns`:
|
.. _`safe teardowns`:
|
||||||
|
|
||||||
Safe teardowns
|
Safe teardowns
|
||||||
|
|
Loading…
Reference in New Issue