Skip to content

Commit 534d174

Browse files
SalmonModenicoddemusbluetech
authored
Clarify fixture execution order and provide visual aids (#7381)
Co-authored-by: Bruno Oliveira <[email protected]> Co-authored-by: Ran Benita <[email protected]>
1 parent cab16f3 commit 534d174

19 files changed

+2413
-454
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Charles Cloud
5656
Charles Machalow
5757
Charnjit SiNGH (CCSJ)
5858
Chris Lamb
59+
Chris NeJame
5960
Christian Boelsen
6061
Christian Fetzer
6162
Christian Neumüller
Lines changed: 132 additions & 0 deletions
Loading
Lines changed: 142 additions & 0 deletions
Loading

doc/en/example/fixtures/test_fixtures_order.py

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import pytest
2+
3+
4+
@pytest.fixture
5+
def order():
6+
return []
7+
8+
9+
@pytest.fixture
10+
def a(order):
11+
order.append("a")
12+
13+
14+
@pytest.fixture
15+
def b(a, order):
16+
order.append("b")
17+
18+
19+
@pytest.fixture(autouse=True)
20+
def c(b, order):
21+
order.append("c")
22+
23+
24+
@pytest.fixture
25+
def d(b, order):
26+
order.append("d")
27+
28+
29+
@pytest.fixture
30+
def e(d, order):
31+
order.append("e")
32+
33+
34+
@pytest.fixture
35+
def f(e, order):
36+
order.append("f")
37+
38+
39+
@pytest.fixture
40+
def g(f, c, order):
41+
order.append("g")
42+
43+
44+
def test_order_and_g(g, order):
45+
assert order == ["a", "b", "c", "d", "e", "f", "g"]

0 commit comments

Comments
 (0)