Skip to content

Commit 231a511

Browse files
committed
Switch to pytest_asyncio.fixture
This is required now that strict mode is the default.
1 parent b28498b commit 231a511

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

test_elasticsearch/test_async/test_server/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import pytest
19+
import pytest_asyncio
1920

2021
import elasticsearch
2122

@@ -24,7 +25,7 @@
2425
pytestmark = pytest.mark.asyncio
2526

2627

27-
@pytest.fixture(scope="function")
28+
@pytest_asyncio.fixture(scope="function")
2829
@pytest.mark.usefixtures("sync_client")
2930
async def async_client(elasticsearch_url):
3031
# 'sync_client' fixture is used for the guaranteed wipe_cluster() call.

test_elasticsearch/test_async/test_server/test_helpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from unittest.mock import MagicMock, call, patch
2121

2222
import pytest
23+
import pytest_asyncio
2324
from elastic_transport import ApiResponseMeta, ObjectApiResponse
2425

2526
from elasticsearch import helpers
@@ -456,7 +457,7 @@ def __await__(self):
456457
return self().__await__()
457458

458459

459-
@pytest.fixture(scope="function")
460+
@pytest_asyncio.fixture(scope="function")
460461
async def scan_teardown(async_client):
461462
yield
462463
await async_client.clear_scroll(scroll_id="_all")
@@ -867,7 +868,7 @@ async def test_scan_from_keyword_is_aliased(async_client, scan_kwargs):
867868
assert "from" not in search_mock.call_args[1]
868869

869870

870-
@pytest.fixture(scope="function")
871+
@pytest_asyncio.fixture(scope="function")
871872
async def reindex_setup(async_client):
872873
bulk = []
873874
for x in range(100):
@@ -945,7 +946,7 @@ async def test_all_documents_get_moved(self, async_client, reindex_setup):
945946
)["_source"]
946947

947948

948-
@pytest.fixture(scope="function")
949+
@pytest_asyncio.fixture(scope="function")
949950
async def parent_reindex_setup(async_client):
950951
body = {
951952
"settings": {"number_of_shards": 1, "number_of_replicas": 0},
@@ -1006,7 +1007,7 @@ async def test_children_are_reindexed_correctly(
10061007
} == q
10071008

10081009

1009-
@pytest.fixture(scope="function")
1010+
@pytest_asyncio.fixture(scope="function")
10101011
async def reindex_data_stream_setup(async_client):
10111012
dt = datetime.now(tz=timezone.utc)
10121013
bulk = []

test_elasticsearch/test_async/test_server/test_mapbox_vector_tile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
# under the License.
1717

1818
import pytest
19+
import pytest_asyncio
1920

2021
from elasticsearch import AsyncElasticsearch, RequestError
2122

2223
pytestmark = pytest.mark.asyncio
2324

2425

25-
@pytest.fixture(scope="function")
26+
@pytest_asyncio.fixture(scope="function")
2627
async def mvt_setup(async_client):
2728
await async_client.indices.create(
2829
index="museums",

test_elasticsearch/test_async/test_server/test_rest_api_spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import warnings
2626

2727
import pytest
28+
import pytest_asyncio
2829

2930
from elasticsearch import ElasticsearchWarning, RequestError
3031

@@ -237,7 +238,7 @@ async def _feature_enabled(self, name):
237238
return name in XPACK_FEATURES
238239

239240

240-
@pytest.fixture(scope="function")
241+
@pytest_asyncio.fixture(scope="function")
241242
def async_runner(async_client):
242243
return AsyncYamlRunner(async_client)
243244

0 commit comments

Comments
 (0)