MCPcopy
hub / github.com/pytest-dev/pytest / test_pass_captures_stdout

Method test_pass_captures_stdout

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

Source from the content-addressed store, hash-verified

864
865 @pytest.mark.parametrize("junit_logging", ["no", "system-out"])
866 def test_pass_captures_stdout(
867 self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
868 ) -> None:
869 pytester.makepyfile(
870 """
871 def test_pass():
872 print('hello-stdout')
873 """
874 )
875 _result, dom = run_and_parse("-o", f"junit_logging={junit_logging}")
876 node = dom.get_first_by_tag("testsuite")
877 pnode = node.get_first_by_tag("testcase")
878 if junit_logging == "no":
879 assert not node.find_by_tag("system-out"), (
880 "system-out should not be generated"
881 )
882 if junit_logging == "system-out":
883 systemout = pnode.get_first_by_tag("system-out")
884 assert "hello-stdout" in systemout.toxml(), (
885 "'hello-stdout' should be in system-out"
886 )
887
888 @pytest.mark.parametrize("junit_logging", ["no", "system-err"])
889 def test_pass_captures_stderr(

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected