Skip to content
Merged
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
6 changes: 3 additions & 3 deletions test_elasticsearch/test_async/test_server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# specific language governing permissions and limitations
# under the License.

import pytest
import pytest_asyncio
import sniffio

import elasticsearch

from ...utils import CA_CERTS, wipe_cluster


@pytest.fixture(scope="function")
@pytest_asyncio.fixture(scope="function")
Copy link
Contributor

@miguelgrinberg miguelgrinberg Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something you introduced, but in the sync side this fixture has a session scope.

Copy link
Member Author

@pquentin pquentin Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional, see the comment below:

    # Unfortunately the asyncio client needs to be rebuilt every
    # test execution due to how pytest-asyncio manages
    # event loops (one per test!)

async def async_client_factory(elasticsearch_url):
kwargs = {}
if sniffio.current_async_library() == "trio":
Expand All @@ -42,7 +42,7 @@ async def async_client_factory(elasticsearch_url):
await client.close()


@pytest.fixture(scope="function")
@pytest_asyncio.fixture(scope="function")
def async_client(async_client_factory):
try:
yield async_client_factory
Expand Down
Loading