Skip to content
Myr

Remove unused concurrency test utils (#989)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by GitHub · parent aa630d3 · Browse files · 1 file+2 added−24 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−24 removed

  • tests:+2 added−24 removed

1 file+2 added−24 removed

modified:tests/concurrency.py+2 added-24 removed
1"""2This module contains concurrency utilities that are only used in tests, thus not3required as part of the ConcurrencyBackend API.2Async environment-agnostic concurrency utilities that are only used in tests.3"""45import asyncio67import sniffio8import trio91012async def sleep(seconds: float):11async def sleep(seconds: float) -> None:12 if sniffio.current_async_library() == "trio":13 await trio.sleep(seconds)14 else:15 await asyncio.sleep(seconds)171819async def run_concurrently(*coroutines):20 if sniffio.current_async_library() == "trio":21 async with trio.open_nursery() as nursery:22 for coroutine in coroutines:23 nursery.start_soon(coroutine)24 else:25 coros = (coroutine() for coroutine in coroutines)26 await asyncio.gather(*coros)272829def get_cipher(stream):30 if sniffio.current_async_library() == "trio":31 return (32 stream.stream.cipher()33 if isinstance(stream.stream, trio.SSLStream)34 else None35 )36 else:37 return stream.stream_writer.get_extra_info("cipher", default=None)