Skip to content

doc: reproducible finalizer order examples #10257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions doc/en/how-to/fixtures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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


Expand All @@ -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

Expand Down