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

Method test_simple

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

Source from the content-addressed store, hash-verified

3627
3628class TestContextManagerFixtureFuncs:
3629 def test_simple(self, pytester: Pytester) -> None:
3630 pytester.makepyfile(
3631 """
3632 import pytest
3633 @pytest.fixture
3634 def arg1():
3635 print("setup")
3636 yield 1
3637 print("teardown")
3638 def test_1(arg1):
3639 print("test1", arg1)
3640 def test_2(arg1):
3641 print("test2", arg1)
3642 assert 0
3643 """
3644 )
3645 result = pytester.runpytest("-s")
3646 result.stdout.fnmatch_lines(
3647 """
3648 *setup*
3649 *test1 1*
3650 *teardown*
3651 *setup*
3652 *test2 1*
3653 *teardown*
3654 """
3655 )
3656
3657 def test_scoped(self, pytester: Pytester) -> None:
3658 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