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