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