diff --git a/test_elasticsearch/test_async/test_server/conftest.py b/test_elasticsearch/test_async/test_server/conftest.py index fd77027e23..6755eb857a 100644 --- a/test_elasticsearch/test_async/test_server/conftest.py +++ b/test_elasticsearch/test_async/test_server/conftest.py @@ -18,16 +18,15 @@ import asyncio import pytest +import pytest_asyncio import elasticsearch from elasticsearch.helpers.test import CA_CERTS, ELASTICSEARCH_URL from ...utils import wipe_cluster -pytestmark = pytest.mark.asyncio - -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def async_client(): client = None try: diff --git a/test_elasticsearch/test_async/test_server/test_helpers.py b/test_elasticsearch/test_async/test_server/test_helpers.py index 49f74b3f55..c3d5f63ec9 100644 --- a/test_elasticsearch/test_async/test_server/test_helpers.py +++ b/test_elasticsearch/test_async/test_server/test_helpers.py @@ -24,6 +24,7 @@ from datetime import datetime, timedelta, timezone import pytest +import pytest_asyncio from mock import MagicMock, patch from elasticsearch import TransportError, helpers @@ -430,7 +431,7 @@ def __await__(self): return self().__await__() -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def scan_teardown(async_client): yield await async_client.clear_scroll(scroll_id="_all") @@ -852,7 +853,7 @@ async def test_scan_from_keyword_is_aliased(self, async_client, scan_kwargs): assert "from" not in search_mock.call_args[1] -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def reindex_setup(async_client): bulk = [] for x in range(100): @@ -930,7 +931,7 @@ async def test_all_documents_get_moved(self, async_client, reindex_setup): )["_source"] -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def parent_reindex_setup(async_client): body = { "settings": {"number_of_shards": 1, "number_of_replicas": 0}, @@ -993,7 +994,7 @@ async def test_children_are_reindexed_correctly( } == q -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def reindex_data_stream_setup(async_client): dt = datetime.now(tz=timezone.utc) bulk = [] diff --git a/test_elasticsearch/test_async/test_server/test_mapbox_vector_tile.py b/test_elasticsearch/test_async/test_server/test_mapbox_vector_tile.py index a4744c9a80..0eeb6873cd 100644 --- a/test_elasticsearch/test_async/test_server/test_mapbox_vector_tile.py +++ b/test_elasticsearch/test_async/test_server/test_mapbox_vector_tile.py @@ -20,6 +20,7 @@ import re import pytest +import pytest_asyncio from elasticsearch import AsyncElasticsearch, RequestError from elasticsearch.helpers.test import CA_CERTS, ELASTICSEARCH_URL @@ -27,7 +28,7 @@ pytestmark = pytest.mark.asyncio -@pytest.fixture(scope="function") +@pytest_asyncio.fixture(scope="function") async def mvt_setup(async_client): await async_client.indices.create( index="museums",