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

Method test_scoped

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

Source from the content-addressed store, hash-verified

3655 )
3656
3657 def test_scoped(self, pytester: Pytester) -> None:
3658 pytester.makepyfile(
3659 """
3660 import pytest
3661 @pytest.fixture(scope="module")
3662 def arg1():
3663 print("setup")
3664 yield 1
3665 print("teardown")
3666 def test_1(arg1):
3667 print("test1", arg1)
3668 def test_2(arg1):
3669 print("test2", arg1)
3670 """
3671 )
3672 result = pytester.runpytest("-s")
3673 result.stdout.fnmatch_lines(
3674 """
3675 *setup*
3676 *test1 1*
3677 *test2 1*
3678 *teardown*
3679 """
3680 )
3681
3682 def test_setup_exception(self, pytester: Pytester) -> None:
3683 pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected