(self, pytester: Pytester)
| 21 | |
| 22 | class TestDoctests: |
| 23 | def test_collect_testtextfile(self, pytester: Pytester): |
| 24 | w = pytester.maketxtfile(whatever="") |
| 25 | checkfile = pytester.maketxtfile( |
| 26 | test_something=""" |
| 27 | alskdjalsdk |
| 28 | >>> i = 5 |
| 29 | >>> i-1 |
| 30 | 4 |
| 31 | """ |
| 32 | ) |
| 33 | |
| 34 | for x in (pytester.path, checkfile): |
| 35 | # print "checking that %s returns custom items" % (x,) |
| 36 | items, _reprec = pytester.inline_genitems(x) |
| 37 | assert len(items) == 1 |
| 38 | assert isinstance(items[0], DoctestItem) |
| 39 | assert isinstance(items[0].parent, DoctestTextfile) |
| 40 | # Empty file has no items. |
| 41 | items, _reprec = pytester.inline_genitems(w) |
| 42 | assert len(items) == 0 |
| 43 | |
| 44 | def test_collect_module_empty(self, pytester: Pytester): |
| 45 | path = pytester.makepyfile(whatever="#") |
nothing calls this directly
no test coverage detected