(monkeypatch)
| 16 | |
| 17 | @pytest.fixture |
| 18 | def mocked_doctest_runner(monkeypatch): |
| 19 | import doctest |
| 20 | |
| 21 | class MockedPdb: |
| 22 | def __init__(self, out): |
| 23 | pass |
| 24 | |
| 25 | def set_trace(self): |
| 26 | raise NotImplementedError("not used") |
| 27 | |
| 28 | def reset(self): |
| 29 | pass |
| 30 | |
| 31 | def set_continue(self): |
| 32 | pass |
| 33 | |
| 34 | monkeypatch.setattr("doctest._OutputRedirectingPdb", MockedPdb) |
| 35 | |
| 36 | class MyDocTestRunner(doctest.DocTestRunner): |
| 37 | def report_failure(self, out, test, example, got): |
| 38 | raise AssertionError( |
| 39 | "'{}' evaluates to '{}', not '{}'".format( |
| 40 | example.source.strip(), got.strip(), example.want.strip() |
| 41 | ) |
| 42 | ) |
| 43 | |
| 44 | return MyDocTestRunner() |
| 45 | |
| 46 | |
| 47 | @contextmanager |
nothing calls this directly
no test coverage detected