]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Remove unused concurrency test utils (#989)
authorFlorimond Manca <florimond.manca@gmail.com>
Sun, 24 May 2020 09:38:24 +0000 (11:38 +0200)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 09:38:24 +0000 (11:38 +0200)
tests/concurrency.py

index 83a6a0609745004c36e98f075eb0549fd4e927c9..412fe0e799ba755199f228f5259f233f7e064d92 100644 (file)
@@ -1,6 +1,5 @@
 """
-This module contains concurrency utilities that are only used in tests, thus not
-required as part of the ConcurrencyBackend API.
+Async environment-agnostic concurrency utilities that are only used in tests.
 """
 
 import asyncio
@@ -9,29 +8,8 @@ import sniffio
 import trio
 
 
-async def sleep(seconds: float):
+async def sleep(seconds: float) -> None:
     if sniffio.current_async_library() == "trio":
         await trio.sleep(seconds)
     else:
         await asyncio.sleep(seconds)
-
-
-async def run_concurrently(*coroutines):
-    if sniffio.current_async_library() == "trio":
-        async with trio.open_nursery() as nursery:
-            for coroutine in coroutines:
-                nursery.start_soon(coroutine)
-    else:
-        coros = (coroutine() for coroutine in coroutines)
-        await asyncio.gather(*coros)
-
-
-def get_cipher(stream):
-    if sniffio.current_async_library() == "trio":
-        return (
-            stream.stream.cipher()
-            if isinstance(stream.stream, trio.SSLStream)
-            else None
-        )
-    else:
-        return stream.stream_writer.get_extra_info("cipher", default=None)