1515from cryptography .hazmat .primitives .asymmetric .ed25519 import Ed25519PublicKey
1616
1717import dispatch .test .httpx
18+ from dispatch .aiohttp import Dispatch , Server
19+ from dispatch .asyncio import Runner
1820from dispatch .experimental .durable .registry import clear_functions
1921from dispatch .function import Arguments , Error , Function , Input , Output , Registry
20- from dispatch .asyncio import Runner
21- from dispatch .aiohttp import Dispatch , Server
2222from dispatch .proto import _any_unpickle as any_unpickle
2323from dispatch .sdk .v1 import call_pb2 as call_pb
2424from dispatch .sdk .v1 import function_pb2 as function_pb
@@ -40,11 +40,12 @@ def run(runner: Runner, server: Server, ready: threading.Event):
4040 with runner :
4141 runner .run (serve (server , ready ))
4242 except RuntimeError as e :
43- pass # silence errors triggered by stopping the loop after tests are done
43+ pass # silence errors triggered by stopping the loop after tests are done
44+
4445
4546async def serve (server : Server , ready : threading .Event ):
4647 async with server :
47- ready .set () # allow the test to continue after the server started
48+ ready .set () # allow the test to continue after the server started
4849 await asyncio .Event ().wait ()
4950
5051
@@ -67,7 +68,9 @@ def setUp(self):
6768
6869 self .client = httpx .Client (timeout = 1.0 )
6970 self .server = Server (host , port , self .dispatch )
70- self .thread = threading .Thread (target = lambda : run (self .runner , self .server , ready ))
71+ self .thread = threading .Thread (
72+ target = lambda : run (self .runner , self .server , ready )
73+ )
7174 self .thread .start ()
7275 ready .wait ()
7376
0 commit comments