mirror of https://github.com/pytest-dev/pytest.git
39 lines
646 B
Python
39 lines
646 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def order():
|
|
return []
|
|
|
|
|
|
@pytest.fixture
|
|
def func(order):
|
|
order.append("function")
|
|
|
|
|
|
@pytest.fixture(scope="class")
|
|
def cls(order):
|
|
order.append("class")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def mod(order):
|
|
order.append("module")
|
|
|
|
|
|
@pytest.fixture(scope="package")
|
|
def pack(order):
|
|
order.append("package")
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def sess(order):
|
|
order.append("session")
|
|
|
|
|
|
class TestClass:
|
|
def test_order(self, func, cls, mod, pack, sess, order):
|
|
assert order == ["session", "package", "module", "class", "function"]
|