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

Function test_show_different_scopes

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

Source from the content-addressed store, hash-verified

37
38
39def test_show_different_scopes(pytester: Pytester, mode) -> None:
40 p = pytester.makepyfile(
41 '''
42 import pytest
43 @pytest.fixture
44 def arg_function():
45 """function scoped fixture"""
46 @pytest.fixture(scope='session')
47 def arg_session():
48 """session scoped fixture"""
49 def test_arg1(arg_session, arg_function):
50 pass
51 '''
52 )
53
54 result = pytester.runpytest(mode, p)
55 assert result.ret == 0
56
57 result.stdout.fnmatch_lines(
58 [
59 "SETUP S arg_session*",
60 "*SETUP F arg_function*",
61 "*test_arg1 (fixtures used: arg_function, arg_session)*",
62 "*TEARDOWN F arg_function*",
63 "TEARDOWN S arg_session*",
64 ]
65 )
66
67
68def test_show_nested_fixtures(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