(self)
| 166 | await srv.wait_closed() # Return immediately |
| 167 | |
| 168 | async def test_wait_closed_race(self): |
| 169 | # Test a regression in 3.12.0, should be fixed in 3.12.1 |
| 170 | async def serve(rd, wr): |
| 171 | try: |
| 172 | await rd.read() |
| 173 | finally: |
| 174 | wr.close() |
| 175 | await wr.wait_closed() |
| 176 | |
| 177 | srv = await asyncio.start_server(serve, socket_helper.HOSTv4, 0) |
| 178 | self.addCleanup(srv.close) |
| 179 | |
| 180 | task = asyncio.create_task(srv.wait_closed()) |
| 181 | await asyncio.sleep(0) |
| 182 | self.assertFalse(task.done()) |
| 183 | addr = srv.sockets[0].getsockname() |
| 184 | (rd, wr) = await asyncio.open_connection(addr[0], addr[1]) |
| 185 | loop = asyncio.get_running_loop() |
| 186 | loop.call_soon(srv.close) |
| 187 | loop.call_soon(wr.close) |
| 188 | await srv.wait_closed() |
| 189 | |
| 190 | async def test_close_clients(self): |
| 191 | async def serve(rd, wr): |
nothing calls this directly
no test coverage detected