@@ -116,7 +116,7 @@ def ssl_echo_serve_sync(
116116 # expect_fail = "raise" expects to fail but raises nevertheless, i.e. it is
117117 # like False but does not print; used where the raised exception is checked
118118 # in the main thread.
119- expect_fail : bool = False ,
119+ expect_fail : bool | str = False ,
120120) -> None :
121121 try :
122122 wrapped = SERVER_CTX .wrap_socket (
@@ -171,7 +171,9 @@ def ssl_echo_serve_sync(
171171# (running in a thread). Useful for testing making connections with different
172172# SSLContexts.
173173@asynccontextmanager
174- async def ssl_echo_server_raw (expect_fail : bool = False ) -> AsyncIterator [SocketStream ]:
174+ async def ssl_echo_server_raw (
175+ expect_fail : bool | str = False ,
176+ ) -> AsyncIterator [SocketStream ]:
175177 a , b = stdlib_socket .socketpair ()
176178 async with trio .open_nursery () as nursery :
177179 # Exiting the 'with a, b' context manager closes the sockets, which
@@ -191,7 +193,7 @@ async def ssl_echo_server_raw(expect_fail: bool = False) -> AsyncIterator[Socket
191193@asynccontextmanager
192194async def ssl_echo_server (
193195 client_ctx : SSLContext ,
194- expect_fail : bool = False ,
196+ expect_fail : bool | str = False ,
195197) -> AsyncIterator [SSLStream [Stream ]]:
196198 async with ssl_echo_server_raw (expect_fail = expect_fail ) as sock :
197199 yield SSLStream (sock , client_ctx , server_hostname = "trio-test-1.example.org" )
0 commit comments