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

Method test_pass_captures_stdout

testing/test_junitxml.py:800–820  ·  view source on GitHub ↗
(
        self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
    )

Source from the content-addressed store, hash-verified

798
799 @pytest.mark.parametrize("junit_logging", ["no", "system-out"])
800 def test_pass_captures_stdout(
801 self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
802 ) -> None:
803 pytester.makepyfile(
804 """
805 def test_pass():
806 print('hello-stdout')
807 """
808 )
809 result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging)
810 node = dom.find_first_by_tag("testsuite")
811 pnode = node.find_first_by_tag("testcase")
812 if junit_logging == "no":
813 assert not node.find_by_tag(
814 "system-out"
815 ), "system-out should not be generated"
816 if junit_logging == "system-out":
817 systemout = pnode.find_first_by_tag("system-out")
818 assert (
819 "hello-stdout" in systemout.toxml()
820 ), "'hello-stdout' should be in system-out"
821
822 @pytest.mark.parametrize("junit_logging", ["no", "system-err"])
823 def test_pass_captures_stderr(

Callers

nothing calls this directly

Calls 5

run_and_parseFunction · 0.85
find_first_by_tagMethod · 0.80
find_by_tagMethod · 0.80
toxmlMethod · 0.80
makepyfileMethod · 0.45

Tested by

no test coverage detected