Skip to content

Commit

Permalink
Clarify fixture execution order and provide visual aids (#7381)
Browse files Browse the repository at this point in the history
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
  • Loading branch information
3 people committed Dec 16, 2020
1 parent cab16f3 commit 534d174
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 534d174

Please sign in to comment.