(self, pytester: Pytester, strict: bool)
| 628 | |
| 629 | @pytest.mark.parametrize("strict", [True, False]) |
| 630 | def test_strict_xfail(self, pytester: Pytester, strict: bool) -> None: |
| 631 | p = pytester.makepyfile( |
| 632 | f""" |
| 633 | import pytest |
| 634 | |
| 635 | @pytest.mark.xfail(reason='unsupported feature', strict={strict}) |
| 636 | def test_foo(): |
| 637 | with open('foo_executed', 'w', encoding='utf-8'): |
| 638 | pass # make sure test executes |
| 639 | """ |
| 640 | ) |
| 641 | result = pytester.runpytest(p, "-rxX") |
| 642 | if strict: |
| 643 | result.stdout.fnmatch_lines( |
| 644 | ["*test_foo*", "*XPASS(strict)*unsupported feature*"] |
| 645 | ) |
| 646 | else: |
| 647 | result.stdout.fnmatch_lines( |
| 648 | [ |
| 649 | "*test_strict_xfail*", |
| 650 | "XPASS test_strict_xfail.py::test_foo - unsupported feature", |
| 651 | ] |
| 652 | ) |
| 653 | assert result.ret == (1 if strict else 0) |
| 654 | assert pytester.path.joinpath("foo_executed").exists() |
| 655 | |
| 656 | @pytest.mark.parametrize("strict", [True, False]) |
| 657 | def test_strict_xfail_condition(self, pytester: Pytester, strict: bool) -> None: |
nothing calls this directly
no test coverage detected