(self)
| 117 | self.__unhandled_exceptions = [] |
| 118 | |
| 119 | def tearDown(self): |
| 120 | excs = [] |
| 121 | for exc in self.__unhandled_exceptions: |
| 122 | if isinstance(exc, ConnectionResetError): |
| 123 | texc = traceback.TracebackException.from_exception( |
| 124 | exc, lookup_lines=False) |
| 125 | if texc.stack[-1].name == "_call_connection_lost": |
| 126 | # On Windows calling socket.shutdown may raise |
| 127 | # ConnectionResetError, which happens in the |
| 128 | # finally block of _call_connection_lost. |
| 129 | continue |
| 130 | excs.append(exc) |
| 131 | |
| 132 | if excs: |
| 133 | formatted = [] |
| 134 | |
| 135 | for i, context in enumerate(excs): |
| 136 | formatted.append(self._format_loop_exception(context, i + 1)) |
| 137 | |
| 138 | self.fail( |
| 139 | 'unexpected exceptions in asynchronous code:\n' + |
| 140 | '\n'.join(formatted)) |
| 141 | |
| 142 | @contextlib.contextmanager |
| 143 | def assertRunUnder(self, delta): |
no test coverage detected