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

Method test_pass_captures_stderr

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

Source from the content-addressed store, hash-verified

821
822 @pytest.mark.parametrize("junit_logging", ["no", "system-err"])
823 def test_pass_captures_stderr(
824 self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
825 ) -> None:
826 pytester.makepyfile(
827 """
828 import sys
829 def test_pass():
830 sys.stderr.write('hello-stderr')
831 """
832 )
833 result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging)
834 node = dom.find_first_by_tag("testsuite")
835 pnode = node.find_first_by_tag("testcase")
836 if junit_logging == "no":
837 assert not node.find_by_tag(
838 "system-err"
839 ), "system-err should not be generated"
840 if junit_logging == "system-err":
841 systemerr = pnode.find_first_by_tag("system-err")
842 assert (
843 "hello-stderr" in systemerr.toxml()
844 ), "'hello-stderr' should be in system-err"
845
846 @pytest.mark.parametrize("junit_logging", ["no", "system-out"])
847 def test_setup_error_captures_stdout(

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