(
self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
)
| 874 | |
| 875 | @pytest.mark.parametrize("junit_logging", ["no", "system-err"]) |
| 876 | def test_setup_error_captures_stderr( |
| 877 | self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str |
| 878 | ) -> None: |
| 879 | pytester.makepyfile( |
| 880 | """ |
| 881 | import sys |
| 882 | import pytest |
| 883 | |
| 884 | @pytest.fixture |
| 885 | def arg(request): |
| 886 | sys.stderr.write('hello-stderr') |
| 887 | raise ValueError() |
| 888 | def test_function(arg): |
| 889 | pass |
| 890 | """ |
| 891 | ) |
| 892 | result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging) |
| 893 | node = dom.find_first_by_tag("testsuite") |
| 894 | pnode = node.find_first_by_tag("testcase") |
| 895 | if junit_logging == "no": |
| 896 | assert not node.find_by_tag( |
| 897 | "system-err" |
| 898 | ), "system-err should not be generated" |
| 899 | if junit_logging == "system-err": |
| 900 | systemerr = pnode.find_first_by_tag("system-err") |
| 901 | assert ( |
| 902 | "hello-stderr" in systemerr.toxml() |
| 903 | ), "'hello-stderr' should be in system-err" |
| 904 | |
| 905 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 906 | def test_avoid_double_stdout( |
nothing calls this directly
no test coverage detected