(
self, pytester: Pytester, junit_logging: str, run_and_parse: RunAndParse
)
| 681 | "junit_logging", ["no", "log", "system-out", "system-err", "out-err", "all"] |
| 682 | ) |
| 683 | def test_xfail_captures_output_once( |
| 684 | self, pytester: Pytester, junit_logging: str, run_and_parse: RunAndParse |
| 685 | ) -> None: |
| 686 | pytester.makepyfile( |
| 687 | """ |
| 688 | import sys |
| 689 | import pytest |
| 690 | |
| 691 | @pytest.mark.xfail() |
| 692 | def test_fail(): |
| 693 | sys.stdout.write('XFAIL This is stdout') |
| 694 | sys.stderr.write('XFAIL This is stderr') |
| 695 | assert 0 |
| 696 | """ |
| 697 | ) |
| 698 | result, dom = run_and_parse("-o", "junit_logging=%s" % junit_logging) |
| 699 | node = dom.find_first_by_tag("testsuite") |
| 700 | tnode = node.find_first_by_tag("testcase") |
| 701 | if junit_logging in ["system-err", "out-err", "all"]: |
| 702 | assert len(tnode.find_by_tag("system-err")) == 1 |
| 703 | else: |
| 704 | assert len(tnode.find_by_tag("system-err")) == 0 |
| 705 | |
| 706 | if junit_logging in ["log", "system-out", "out-err", "all"]: |
| 707 | assert len(tnode.find_by_tag("system-out")) == 1 |
| 708 | else: |
| 709 | assert len(tnode.find_by_tag("system-out")) == 0 |
| 710 | |
| 711 | @parametrize_families |
| 712 | def test_xfailure_xpass( |
nothing calls this directly
no test coverage detected