httpx/tests/concurrency.py
Florimond Manca 3674058ff7
Parametrize tests with concurrency backend (#273)
* Parametrize tests with concurrency backend

* Refactor server restart

* Add no-backend test
2019-08-25 20:25:18 +02:00

20 lines
438 B
Python

"""
This module contains concurrency utilities that are only used in tests, thus not
required as part of the ConcurrencyBackend API.
"""
import asyncio
import functools
from httpx import AsyncioBackend
@functools.singledispatch
async def sleep(backend, seconds: int):
raise NotImplementedError # pragma: no cover
@sleep.register(AsyncioBackend)
async def _sleep_asyncio(backend, seconds: int):
await asyncio.sleep(seconds)