(pytester: Pytester)
| 1305 | |
| 1306 | |
| 1307 | def test_xfail_item(pytester: Pytester) -> None: |
| 1308 | # Ensure pytest.xfail works with non-Python Item |
| 1309 | pytester.makeconftest( |
| 1310 | """ |
| 1311 | import pytest |
| 1312 | |
| 1313 | class MyItem(pytest.Item): |
| 1314 | nodeid = 'foo' |
| 1315 | def runtest(self): |
| 1316 | pytest.xfail("Expected Failure") |
| 1317 | |
| 1318 | def pytest_collect_file(file_path, parent): |
| 1319 | return MyItem.from_parent(name="foo", parent=parent) |
| 1320 | """ |
| 1321 | ) |
| 1322 | result = pytester.inline_run() |
| 1323 | passed, skipped, failed = result.listoutcomes() |
| 1324 | assert not failed |
| 1325 | xfailed = [r for r in skipped if hasattr(r, "wasxfail")] |
| 1326 | assert xfailed |
| 1327 | |
| 1328 | |
| 1329 | def test_module_level_skip_error(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected