(
self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
)
| 845 | |
| 846 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 847 | def test_setup_error_captures_stdout( |
| 848 | self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str |
| 849 | ) -> None: |
| 850 | pytester.makepyfile( |
| 851 | """ |
| 852 | import pytest |
| 853 | |
| 854 | @pytest.fixture |
| 855 | def arg(request): |
| 856 | print('hello-stdout') |
| 857 | raise ValueError() |
| 858 | def test_function(arg): |
| 859 | pass |
| 860 | """ |
| 861 | ) |
| 862 | result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging) |
| 863 | node = dom.find_first_by_tag("testsuite") |
| 864 | pnode = node.find_first_by_tag("testcase") |
| 865 | if junit_logging == "no": |
| 866 | assert not node.find_by_tag( |
| 867 | "system-out" |
| 868 | ), "system-out should not be generated" |
| 869 | if junit_logging == "system-out": |
| 870 | systemout = pnode.find_first_by_tag("system-out") |
| 871 | assert ( |
| 872 | "hello-stdout" in systemout.toxml() |
| 873 | ), "'hello-stdout' should be in system-out" |
| 874 | |
| 875 | @pytest.mark.parametrize("junit_logging", ["no", "system-err"]) |
| 876 | def test_setup_error_captures_stderr( |
nothing calls this directly
no test coverage detected