(self, pytester: Pytester)
| 6 | |
| 7 | class SessionTests: |
| 8 | def test_basic_testitem_events(self, pytester: Pytester) -> None: |
| 9 | tfile = pytester.makepyfile( |
| 10 | """ |
| 11 | def test_one(): |
| 12 | pass |
| 13 | def test_one_one(): |
| 14 | assert 0 |
| 15 | def test_other(): |
| 16 | raise ValueError(23) |
| 17 | class TestClass(object): |
| 18 | def test_two(self, someargs): |
| 19 | pass |
| 20 | """ |
| 21 | ) |
| 22 | reprec = pytester.inline_run(tfile) |
| 23 | passed, skipped, failed = reprec.listoutcomes() |
| 24 | assert len(skipped) == 0 |
| 25 | assert len(passed) == 1 |
| 26 | assert len(failed) == 3 |
| 27 | |
| 28 | def end(x): |
| 29 | return x.nodeid.split("::")[-1] |
| 30 | |
| 31 | assert end(failed[0]) == "test_one_one" |
| 32 | assert end(failed[1]) == "test_other" |
| 33 | itemstarted = reprec.getcalls("pytest_itemcollected") |
| 34 | assert len(itemstarted) == 4 |
| 35 | # XXX check for failing funcarg setup |
| 36 | # colreports = reprec.getcalls("pytest_collectreport") |
| 37 | # assert len(colreports) == 4 |
| 38 | # assert colreports[1].report.failed |
| 39 | |
| 40 | def test_nested_import_error(self, pytester: Pytester) -> None: |
| 41 | tfile = pytester.makepyfile( |
nothing calls this directly
no test coverage detected