MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_scope_ordering

Method test_scope_ordering

testing/python/fixtures.py:2089–2110  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

2087 assert values == ["fin_a1", "fin_a2", "fin_b1", "fin_b2"] * 2
2088
2089 def test_scope_ordering(self, pytester: Pytester) -> None:
2090 pytester.makepyfile(
2091 """
2092 import pytest
2093 values = []
2094 @pytest.fixture(scope="function", autouse=True)
2095 def fappend2():
2096 values.append(2)
2097 @pytest.fixture(scope="class", autouse=True)
2098 def classappend3():
2099 values.append(3)
2100 @pytest.fixture(scope="module", autouse=True)
2101 def mappend():
2102 values.append(1)
2103
2104 class TestHallo(object):
2105 def test_method(self):
2106 assert values == [1,3,2]
2107 """
2108 )
2109 reprec = pytester.inline_run()
2110 reprec.assertoutcome(passed=1)
2111
2112 def test_parametrization_setup_teardown_ordering(self, pytester: Pytester) -> None:
2113 pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected