Skip to content

Commit e37a5ef

Browse files
committed
session loop
1 parent 8f3ea95 commit e37a5ef

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

test_elasticsearch/_async/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from typing import Tuple
1919

20+
import asyncio
2021
import pytest
2122
import pytest_asyncio
2223

@@ -25,6 +26,13 @@
2526
from .cluster import CA_CERTS, es_url, es_version
2627

2728

29+
@pytest.fixture(scope="session")
30+
def event_loop():
31+
loop = asyncio.get_event_loop()
32+
yield loop
33+
loop.close()
34+
35+
2836
@pytest_asyncio.fixture(scope="session")
2937
async def elasticsearch_url():
3038
try:

test_elasticsearch/_async/test_server/conftest.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
import os
1919

20-
import asyncio
21-
import pytest
2220
import pytest_asyncio
2321

2422
from elasticsearch import AsyncElasticsearch
@@ -54,15 +52,8 @@ def _create(elasticsearch_url, transport=None, node_class=None):
5452
return AsyncElasticsearch(elasticsearch_url, **kw)
5553

5654

57-
@pytest.fixture(scope="function")
58-
def event_loop():
59-
loop = asyncio.get_event_loop()
60-
yield loop
61-
loop.close()
62-
63-
6455
@pytest_asyncio.fixture(scope="function")
65-
async def client_factory(elasticsearch_url, event_loop):
56+
async def client_factory(elasticsearch_url):
6657
client = None
6758
try:
6859
client = _create(elasticsearch_url)
@@ -77,7 +68,7 @@ async def client_factory(elasticsearch_url, event_loop):
7768

7869

7970
@pytest_asyncio.fixture(scope="function")
80-
async def es_client(client_factory, event_loop):
71+
async def es_client(client_factory):
8172
try:
8273
yield client_factory
8374
finally:

0 commit comments

Comments
 (0)