Skip to content

Commit 1afa78a

Browse files
authored
Switch to pytest_asyncio.fixture (#43)
1 parent b0f990d commit 1afa78a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

test_elasticsearch_serverless/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_serverless import helpers
@@ -448,7 +449,7 @@ def __await__(self):
448449
return self().__await__()
449450

450451

451-
@pytest.fixture(scope="function")
452+
@pytest_asyncio.fixture(scope="function")
452453
async def scan_teardown(async_client):
453454
yield
454455
await async_client.clear_scroll(scroll_id="_all")
@@ -859,7 +860,7 @@ async def test_scan_from_keyword_is_aliased(async_client, scan_kwargs):
859860
assert "from" not in search_mock.call_args[1]
860861

861862

862-
@pytest.fixture(scope="function")
863+
@pytest_asyncio.fixture(scope="function")
863864
async def reindex_setup(async_client):
864865
bulk = []
865866
for x in range(100):
@@ -941,7 +942,7 @@ async def test_all_documents_get_moved(self, async_client, reindex_setup):
941942
)["_source"]
942943

943944

944-
@pytest.fixture(scope="function")
945+
@pytest_asyncio.fixture(scope="function")
945946
async def parent_reindex_setup(async_client):
946947
body = {
947948
"mappings": {
@@ -1001,7 +1002,7 @@ async def test_children_are_reindexed_correctly(
10011002
} == q
10021003

10031004

1004-
@pytest.fixture(scope="function")
1005+
@pytest_asyncio.fixture(scope="function")
10051006
async def reindex_data_stream_setup(async_client):
10061007
dt = datetime.now(tz=timezone.utc)
10071008
bulk = []

test_elasticsearch_serverless/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_serverless 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_serverless/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_serverless 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)