(
self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
)
| 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( |
nothing calls this directly
no test coverage detected