httpx/tests/concurrency.py
Josep Cugat 620b0670db
Increase test coverage - take 2 (#1012)
* Fix HttpError -> HTTPError typo

* Increased test coverage

* Increase coverage threshold

* Reuse sync/async transport code in test_auth.py

* Removed close_client check inside StreamContextManager

It's never set as True when used in async

* Reuse sync/async transport code in test_redirects.py
2020-06-02 10:24:45 +01:00

16 lines
323 B
Python

"""
Async environment-agnostic concurrency utilities that are only used in tests.
"""
import asyncio
import sniffio
import trio
async def sleep(seconds: float) -> None:
if sniffio.current_async_library() == "trio":
await trio.sleep(seconds) # pragma: nocover
else:
await asyncio.sleep(seconds)