Skip to content

Commit 6be6459

Browse files
committed
pytest_plugin(feat): Add asyncio to doctest_namespace
why: Enable async doctests to use asyncio.run() what: - Import asyncio module - Add asyncio to doctest_namespace in add_doctest_fixtures
1 parent da77a13 commit 6be6459

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/libvcs/pytest_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import asyncio
56
import functools
67
import getpass
78
import pathlib
@@ -851,6 +852,8 @@ def add_doctest_fixtures(
851852

852853
if not isinstance(request._pyfuncitem, DoctestItem): # Only run on doctest items
853854
return
855+
# Add asyncio for async doctests
856+
doctest_namespace["asyncio"] = asyncio
854857
doctest_namespace["tmp_path"] = tmp_path
855858
if shutil.which("git"):
856859
doctest_namespace["create_git_remote_repo"] = functools.partial(

0 commit comments

Comments
 (0)