Skip to content

Instantly share code, notes, and snippets.

@JosXa
Created October 11, 2020 02:59
Show Gist options
  • Save JosXa/3f4bc07260f76498cf58b6025e488d40 to your computer and use it in GitHub Desktop.
Save JosXa/3f4bc07260f76498cf58b6025e488d40 to your computer and use it in GitHub Desktop.
from contextlib import asynccontextmanager
from typing import AsyncGenerator
import pytest
@pytest.mark.asyncio
async def test():
async with ctm() as r:
print(r)
@asynccontextmanager
async def ctm() -> AsyncGenerator[None, str]:
async with ctm_2() as r:
yield r
@asynccontextmanager
async def ctm_2() -> AsyncGenerator[None, str]:
yield "henlo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment