-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5600 from wojtekerbetowski/issues/3404
Add autouse fixture order information (#3404).
- Loading branch information
Showing
2 changed files
with
48 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
# fixtures documentation order example | ||
order = [] | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def s1(): | ||
order.append("s1") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def m1(): | ||
order.append("m1") | ||
|
||
|
||
@pytest.fixture | ||
def f1(f3): | ||
order.append("f1") | ||
|
||
|
||
@pytest.fixture | ||
def f3(): | ||
order.append("f3") | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def a1(): | ||
order.append("a1") | ||
|
||
|
||
@pytest.fixture | ||
def f2(): | ||
order.append("f2") | ||
|
||
|
||
def test_order(f1, m1, f2, s1): | ||
assert order == ["s1", "m1", "a1", "f3", "f1", "f2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters