Run the server.
(self, sockets: list[socket] | None = None)
| 530 | await self.startup() |
| 531 | |
| 532 | def run(self, sockets: list[socket] | None = None) -> None: |
| 533 | """Run the server.""" |
| 534 | # Set the event loop policy in thread with server for Windows and Python 3.12+. |
| 535 | # This is necessary because there are problems with closing connections when using `ProactorEventLoop`. |
| 536 | if sys.version_info >= (3, 12) and sys.platform == 'win32': |
| 537 | return asyncio.run(self.serve(sockets=sockets), loop_factory=asyncio.SelectorEventLoop) |
| 538 | super().run(sockets=sockets) |
| 539 | return None |
| 540 | |
| 541 | |
| 542 | def serve_in_thread(server: TestServer) -> Iterator[TestServer]: |