Skip to content

Switch to pytest_asyncio.fixture #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from unittest.mock import MagicMock, call, patch

import pytest
import pytest_asyncio
from elastic_transport import ApiResponseMeta, ObjectApiResponse

from elasticsearch_serverless import helpers
Expand Down Expand Up @@ -448,7 +449,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")
Expand Down Expand Up @@ -859,7 +860,7 @@ async def test_scan_from_keyword_is_aliased(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):
Expand Down Expand Up @@ -941,7 +942,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 = {
"mappings": {
Expand Down Expand Up @@ -1001,7 +1002,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 = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
# under the License.

import pytest
import pytest_asyncio

from elasticsearch_serverless import AsyncElasticsearch, RequestError

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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import warnings

import pytest
import pytest_asyncio

from elasticsearch_serverless import ElasticsearchWarning, RequestError

Expand Down Expand Up @@ -237,7 +238,7 @@ async def _feature_enabled(self, name):
return name in XPACK_FEATURES


@pytest.fixture(scope="function")
@pytest_asyncio.fixture(scope="function")
def async_runner(async_client):
return AsyncYamlRunner(async_client)

Expand Down
Loading