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

Function test_show_fixtures_with_autouse

testing/test_setuponly.py:102–126  ·  view source on GitHub ↗
(pytester: Pytester, mode)

Source from the content-addressed store, hash-verified

100
101
102def test_show_fixtures_with_autouse(pytester: Pytester, mode) -> None:
103 p = pytester.makepyfile(
104 '''
105 import pytest
106 @pytest.fixture
107 def arg_function():
108 """function scoped fixture"""
109 @pytest.fixture(scope='session', autouse=True)
110 def arg_session():
111 """session scoped fixture"""
112 def test_arg1(arg_function):
113 pass
114 '''
115 )
116
117 result = pytester.runpytest(mode, p)
118 assert result.ret == 0
119
120 result.stdout.fnmatch_lines(
121 [
122 "SETUP S arg_session*",
123 "*SETUP F arg_function*",
124 "*test_arg1 (fixtures used: arg_function, arg_session)*",
125 ]
126 )
127
128
129def test_show_fixtures_with_parameters(pytester: Pytester, mode) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected