Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions python/tests/unit/data/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import ast
import asyncio
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from typing import Annotated, Any
Expand All @@ -23,6 +24,24 @@
from semantic_kernel.kernel_types import OptionalOneOrMany


@fixture(autouse=True)
def _ensure_event_loop():
"""Ensure a current event loop exists before each test.

Works around a pytest-asyncio 0.26 bug on Windows Python 3.10 where
asyncio.set_event_loop(None) can be left as state after a previous test's
teardown, and _provide_clean_event_loop does not recover because it only
creates a fresh loop when old_loop is not None. By guaranteeing a non-None
loop at fixture-setup time, _temporary_event_loop_policy saves a valid
old_loop, so the teardown path restores a valid loop instead of None.
"""
try:
asyncio.get_event_loop()
except RuntimeError:
asyncio.set_event_loop(asyncio.new_event_loop())
yield


@fixture
def DictVectorStoreRecordCollection() -> type[VectorSearch]:
class DictVectorStoreRecordCollection(
Expand Down
15 changes: 8 additions & 7 deletions python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading