Skip to content
Myr

concurrency.py

This file

Path

tests/concurrency.py

19 lines · 438 bytes · Python

Last changed by

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

History of this file

Take it

Parametrize tests with concurrency backend (#273)Florimond Mancabefore adoption3674058

lines 1–19why, one step back
1"""
2This module contains concurrency utilities that are only used in tests, thus not3required as part of the ConcurrencyBackend API.4"""56import asyncio7import functools89from httpx import AsyncioBackend101112@functools.singledispatch13async def sleep(backend, seconds: int):14 raise NotImplementedError # pragma: no cover151617@sleep.register(AsyncioBackend)18async def _sleep_asyncio(backend, seconds: int):19 await asyncio.sleep(seconds)