Warnings raised during importing of conftest.py files is captured (#2891).
(self, pytester: Pytester)
| 718 | |
| 719 | @pytest.mark.filterwarnings("default") |
| 720 | def test_conftest_warning_captured(self, pytester: Pytester) -> None: |
| 721 | """Warnings raised during importing of conftest.py files is captured (#2891).""" |
| 722 | pytester.makeconftest( |
| 723 | """ |
| 724 | import warnings |
| 725 | warnings.warn(UserWarning("my custom warning")) |
| 726 | """ |
| 727 | ) |
| 728 | result = pytester.runpytest() |
| 729 | result.stdout.fnmatch_lines( |
| 730 | ["conftest.py:2", "*UserWarning: my custom warning*"] |
| 731 | ) |
| 732 | |
| 733 | def test_issue4445_import_plugin(self, pytester: Pytester, capwarn) -> None: |
| 734 | """#4445: Make sure the warning points to a reasonable location""" |
nothing calls this directly
no test coverage detected