(
self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str
)
| 904 | |
| 905 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 906 | def test_avoid_double_stdout( |
| 907 | self, pytester: Pytester, run_and_parse: RunAndParse, junit_logging: str |
| 908 | ) -> None: |
| 909 | pytester.makepyfile( |
| 910 | """ |
| 911 | import sys |
| 912 | import pytest |
| 913 | |
| 914 | @pytest.fixture |
| 915 | def arg(request): |
| 916 | yield |
| 917 | sys.stdout.write('hello-stdout teardown') |
| 918 | raise ValueError() |
| 919 | def test_function(arg): |
| 920 | sys.stdout.write('hello-stdout call') |
| 921 | """ |
| 922 | ) |
| 923 | result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging) |
| 924 | node = dom.find_first_by_tag("testsuite") |
| 925 | pnode = node.find_first_by_tag("testcase") |
| 926 | if junit_logging == "no": |
| 927 | assert not node.find_by_tag( |
| 928 | "system-out" |
| 929 | ), "system-out should not be generated" |
| 930 | if junit_logging == "system-out": |
| 931 | systemout = pnode.find_first_by_tag("system-out") |
| 932 | assert "hello-stdout call" in systemout.toxml() |
| 933 | assert "hello-stdout teardown" in systemout.toxml() |
| 934 | |
| 935 | |
| 936 | def test_mangle_test_address() -> None: |
nothing calls this directly
no test coverage detected