From e439e1d20aecb1c02d80a85e8a37f626616e2549 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Tue, 30 Aug 2022 11:37:15 -0400 Subject: [PATCH] doc: reproducible finalizer order examples --- doc/en/how-to/fixtures.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/en/how-to/fixtures.rst b/doc/en/how-to/fixtures.rst index 8ab498bd7..680a67e85 100644 --- a/doc/en/how-to/fixtures.rst +++ b/doc/en/how-to/fixtures.rst @@ -769,12 +769,12 @@ For yield fixtures, the first teardown code to run is from the right-most fixtur .. code-block:: pytest - $ pytest test_module.py + $ pytest -s test_yield.py =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y collected 1 item - test_module.py test_bar + test_yield.py test_bar .after_yield_2 after_yield_1 @@ -784,6 +784,8 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`. .. code-block:: python + from functools import partial + import pytest @@ -799,12 +801,12 @@ For finalizers, the first fixture to run is last call to `request.addfinalizer`. .. code-block:: pytest - $ pytest test_module.py + $ pytest -s test_finalizer.py =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y collected 1 item - test_module.py test_bar + test_finalizer.py test_bar .finalizer_1 finalizer_2