Skip to content

Commit d8f4361

Browse files
committed
Stop using event_loop fixture (elastic#2969)
It was removed in pytest-asyncio 1.0. (cherry picked from commit 3c9680a) # Conflicts: # docs/reference/async.md
1 parent 82c9d98 commit d8f4361

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/guide/async.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ async def main():
3737
)
3838
print(resp)
3939
40-
loop = asyncio.get_event_loop()
41-
loop.run_until_complete(main())
40+
asyncio.run(main())
4241
----
4342

4443
All APIs that are available under the sync client are also available

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,
@@ -581,7 +582,8 @@ async def test_sniffing_disabled_on_elastic_cloud(self, kwargs):
581582
== "Sniffing should not be enabled when connecting to Elastic Cloud"
582583
)
583584

584-
async def test_sniff_on_start_close_unlocks_async_calls(self, event_loop):
585+
async def test_sniff_on_start_close_unlocks_async_calls(self):
586+
event_loop = asyncio.get_running_loop()
585587
client = AsyncElasticsearch( # noqa: F821
586588
[
587589
NodeConfig(

0 commit comments

Comments
 (0)