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