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

Method test_pass_captures_stderr

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

Source from the content-addressed store, hash-verified

887
888 @pytest.mark.parametrize("junit_logging", ["no", "system-err"])
889 def test_pass_captures_stderr(
890 self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
891 ) -> None:
892 pytester.makepyfile(
893 """
894 import sys
895 def test_pass():
896 sys.stderr.write('hello-stderr')
897 """
898 )
899 _result, dom = run_and_parse("-o", f"junit_logging={junit_logging}")
900 node = dom.get_first_by_tag("testsuite")
901 pnode = node.get_first_by_tag("testcase")
902 if junit_logging == "no":
903 assert not node.find_by_tag("system-err"), (
904 "system-err should not be generated"
905 )
906 if junit_logging == "system-err":
907 systemerr = pnode.get_first_by_tag("system-err")
908 assert "hello-stderr" in systemerr.toxml(), (
909 "'hello-stderr' should be in system-err"
910 )
911
912 @pytest.mark.parametrize("junit_logging", ["no", "system-out"])
913 def test_setup_error_captures_stdout(

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