A logging handler capturing all (raw and formatted) logging output.
| 8 | ["records", "output"]) |
| 9 | |
| 10 | class _CapturingHandler(logging.Handler): |
| 11 | """ |
| 12 | A logging handler capturing all (raw and formatted) logging output. |
| 13 | """ |
| 14 | |
| 15 | def __init__(self): |
| 16 | logging.Handler.__init__(self) |
| 17 | self.watcher = _LoggingWatcher([], []) |
| 18 | |
| 19 | def flush(self): |
| 20 | pass |
| 21 | |
| 22 | def emit(self, record): |
| 23 | self.watcher.records.append(record) |
| 24 | msg = self.format(record) |
| 25 | self.watcher.output.append(msg) |
| 26 | |
| 27 | |
| 28 | class _AssertLogsContext(_BaseTestCaseContext): |
no outgoing calls
no test coverage detected
searching dependent graphs…