(
self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
)
| 798 | |
| 799 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 800 | def test_pass_captures_stdout( |
| 801 | self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str |
| 802 | ) -> None: |
| 803 | pytester.makepyfile( |
| 804 | """ |
| 805 | def test_pass(): |
| 806 | print('hello-stdout') |
| 807 | """ |
| 808 | ) |
| 809 | result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging) |
| 810 | node = dom.find_first_by_tag("testsuite") |
| 811 | pnode = node.find_first_by_tag("testcase") |
| 812 | if junit_logging == "no": |
| 813 | assert not node.find_by_tag( |
| 814 | "system-out" |
| 815 | ), "system-out should not be generated" |
| 816 | if junit_logging == "system-out": |
| 817 | systemout = pnode.find_first_by_tag("system-out") |
| 818 | assert ( |
| 819 | "hello-stdout" in systemout.toxml() |
| 820 | ), "'hello-stdout' should be in system-out" |
| 821 | |
| 822 | @pytest.mark.parametrize("junit_logging", ["no", "system-err"]) |
| 823 | def test_pass_captures_stderr( |
nothing calls this directly
no test coverage detected