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

Method test_setup

testing/python/fixtures.py:3230–3249  ·  view source on GitHub ↗
(self, pytester: Pytester, scope, ok, error)

Source from the content-addressed store, hash-verified

3228 )
3229
3230 def test_setup(self, pytester: Pytester, scope, ok, error) -> None:
3231 pytester.makepyfile(
3232 """
3233 import pytest
3234 @pytest.fixture(scope=%r, autouse=True)
3235 def myscoped(request):
3236 for x in %r:
3237 assert hasattr(request, x)
3238 for x in %r:
3239 pytest.raises(AttributeError, lambda:
3240 getattr(request, x))
3241 assert request.session
3242 assert request.config
3243 def test_func():
3244 pass
3245 """
3246 % (scope, ok.split(), error.split())
3247 )
3248 reprec = pytester.inline_run("-l")
3249 reprec.assertoutcome(passed=1)
3250
3251 def test_funcarg(self, pytester: Pytester, scope, ok, error) -> None:
3252 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