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