Skip to content

Commit

Permalink
Merge pull request pytest-dev#8160 from nicoddemus/backport-7381
Browse files Browse the repository at this point in the history
[6.2.x] Clarify fixture execution order and provide visual aids (pytest-dev#7381)
  • Loading branch information
nicoddemus committed Dec 16, 2020
2 parents a566eb9 + da82e18 commit 1f0c50b
Show file tree
Hide file tree
Showing 19 changed files with 2,413 additions and 454 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -56,6 +56,7 @@ Charles Cloud
Charles Machalow
Charnjit SiNGH (CCSJ)
Chris Lamb
Chris NeJame
Christian Boelsen
Christian Fetzer
Christian Neumüller
Expand Down
132 changes: 132 additions & 0 deletions doc/en/example/fixtures/fixture_availability.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
142 changes: 142 additions & 0 deletions doc/en/example/fixtures/fixture_availability_plugins.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 0 additions & 38 deletions doc/en/example/fixtures/test_fixtures_order.py

This file was deleted.

45 changes: 45 additions & 0 deletions doc/en/example/fixtures/test_fixtures_order_autouse.py
@@ -0,0 +1,45 @@
import pytest


@pytest.fixture
def order():
return []


@pytest.fixture
def a(order):
order.append("a")


@pytest.fixture
def b(a, order):
order.append("b")


@pytest.fixture(autouse=True)
def c(b, order):
order.append("c")


@pytest.fixture
def d(b, order):
order.append("d")


@pytest.fixture
def e(d, order):
order.append("e")


@pytest.fixture
def f(e, order):
order.append("f")


@pytest.fixture
def g(f, c, order):
order.append("g")


def test_order_and_g(g, order):
assert order == ["a", "b", "c", "d", "e", "f", "g"]

0 comments on commit 1f0c50b

Please sign in to comment.