@@ -742,10 +742,10 @@ Note on finalizer order
742
742
Finalizers are executed in a first-in-last-out order.
743
743
For yield fixtures, the first teardown code to run is from the right-most fixture, i.e. the last test parameter.
744
744
745
- .. regendoc:wipe
746
745
747
746
.. code-block :: python
748
747
748
+ # content of test_finalizers.py
749
749
import pytest
750
750
751
751
@@ -767,12 +767,12 @@ For yield fixtures, the first teardown code to run is from the right-most fixtur
767
767
768
768
.. code-block :: pytest
769
769
770
- $ pytest test_module .py
770
+ $ pytest -s test_finalizers .py
771
771
=========================== test session starts ============================
772
772
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
773
773
collected 1 item
774
774
775
- test_module .py test_bar
775
+ test_finalizers .py test_bar
776
776
.after_yield_2
777
777
after_yield_1
778
778
@@ -782,6 +782,8 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`.
782
782
783
783
.. code-block :: python
784
784
785
+ # content of test_finalizers.py
786
+ from functools import partial
785
787
import pytest
786
788
787
789
@@ -797,12 +799,12 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`.
797
799
798
800
.. code-block :: pytest
799
801
800
- $ pytest test_module .py
802
+ $ pytest -s test_finalizers .py
801
803
=========================== test session starts ============================
802
804
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
803
805
collected 1 item
804
806
805
- test_module .py test_bar
807
+ test_finalizers .py test_bar
806
808
.finalizer_1
807
809
finalizer_2
808
810
@@ -1412,6 +1414,8 @@ Running the above tests results in the following test IDs being used:
1412
1414
<Function test_showhelo[mail.python.org]>
1413
1415
<Module test_emaillib.py>
1414
1416
<Function test_email_received>
1417
+ <Module test_finalizers.py>
1418
+ <Function test_bar>
1415
1419
<Module test_ids.py>
1416
1420
<Function test_a[spam]>
1417
1421
<Function test_a[ham]>
0 commit comments