Skip to content

Commit 0ad0816

Browse files
committed
Stop using event_loop fixture
It was removed in pytest-asyncio 1.0.
1 parent e377f80 commit 0ad0816

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/reference/async.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ async def main():
3434
)
3535
print(resp)
3636

37-
loop = asyncio.get_event_loop()
38-
loop.run_until_complete(main())
37+
asyncio.run(main())
3938
```
4039

4140
All APIs that are available under the sync client are also available under the async client.

test_elasticsearch/test_async/test_transport.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ async def test_sniff_on_node_failure_triggers(self, extra_key, extra_value):
527527
assert request_failed_in_error
528528
assert len(client.transport.node_pool) == 3
529529

530-
async def test_sniff_after_n_seconds(self, event_loop):
530+
async def test_sniff_after_n_seconds(self):
531+
event_loop = asyncio.get_running_loop()
531532
client = AsyncElasticsearch( # noqa: F821
532533
[NodeConfig("http", "localhost", 9200, _extras={"data": CLUSTER_NODES})],
533534
node_class=DummyNode,
@@ -579,7 +580,8 @@ async def test_sniffing_disabled_on_elastic_cloud(self, kwargs):
579580
== "Sniffing should not be enabled when connecting to Elastic Cloud"
580581
)
581582

582-
async def test_sniff_on_start_close_unlocks_async_calls(self, event_loop):
583+
async def test_sniff_on_start_close_unlocks_async_calls(self):
584+
event_loop = asyncio.get_running_loop()
583585
client = AsyncElasticsearch( # noqa: F821
584586
[
585587
NodeConfig(

0 commit comments

Comments
 (0)