(pytester: Pytester)
| 1291 | |
| 1292 | |
| 1293 | def test_xfail_item(pytester: Pytester) -> None: |
| 1294 | # Ensure pytest.xfail works with non-Python Item |
| 1295 | pytester.makeconftest( |
| 1296 | """ |
| 1297 | import pytest |
| 1298 | |
| 1299 | class MyItem(pytest.Item): |
| 1300 | nodeid = 'foo' |
| 1301 | def runtest(self): |
| 1302 | pytest.xfail("Expected Failure") |
| 1303 | |
| 1304 | def pytest_collect_file(file_path, parent): |
| 1305 | return MyItem.from_parent(name="foo", parent=parent) |
| 1306 | """ |
| 1307 | ) |
| 1308 | result = pytester.inline_run() |
| 1309 | _passed, skipped, failed = result.listoutcomes() |
| 1310 | assert not failed |
| 1311 | xfailed = [r for r in skipped if hasattr(r, "wasxfail")] |
| 1312 | assert xfailed |
| 1313 | |
| 1314 | |
| 1315 | def test_module_level_skip_error(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected