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

Method test_funcarg_and_setup

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

Source from the content-addressed store, hash-verified

1962 reprec.assertoutcome(passed=1)
1963
1964 def test_funcarg_and_setup(self, pytester: Pytester) -> None:
1965 pytester.makepyfile(
1966 """
1967 import pytest
1968 values = []
1969 @pytest.fixture(scope="module")
1970 def arg():
1971 values.append(1)
1972 return 0
1973 @pytest.fixture(scope="module", autouse=True)
1974 def something(arg):
1975 values.append(2)
1976
1977 def test_hello(arg):
1978 assert len(values) == 2
1979 assert values == [1,2]
1980 assert arg == 0
1981
1982 def test_hello2(arg):
1983 assert len(values) == 2
1984 assert values == [1,2]
1985 assert arg == 0
1986 """
1987 )
1988 reprec = pytester.inline_run()
1989 reprec.assertoutcome(passed=2)
1990
1991 def test_uses_parametrized_resource(self, pytester: Pytester) -> None:
1992 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