File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1313
1414pytest_plugins = ['tests.integration.shared.fixtures_services' ]
1515
16+ try : # pragma: no cover - optional dependency guard
17+ import pytest_asyncio # type: ignore[unused-import]
18+ HAS_PYTEST_ASYNCIO = True
19+ except ImportError : # pragma: no cover - plugin unavailable
20+ HAS_PYTEST_ASYNCIO = False
21+
1622# This code adds the project root directory to the Python path, allowing imports to work correctly when running tests.
1723# Without this file, you might encounter ModuleNotFoundError when trying to import modules from your project, especially when running tests.
1824sys .path .insert (0 , os .path .abspath (os .path .join (os .path .dirname (__file__ ))))
@@ -49,6 +55,14 @@ def mock_embedder():
4955 return make_mock_embedder ()
5056
5157
58+ def pytest_collection_modifyitems (config , items ): # pragma: no cover - discovery guard
59+ if not HAS_PYTEST_ASYNCIO :
60+ skip_asyncio = pytest .mark .skip (reason = 'pytest-asyncio is not installed in this environment' )
61+ for item in items :
62+ if 'asyncio' in item .keywords :
63+ item .add_marker (skip_asyncio )
64+
65+
5266@pytest .fixture (scope = 'session' , autouse = True )
5367def _patch_aiohttp_client_session ():
5468 yield
You can’t perform that action at this time.
0 commit comments