From 230dacea661c6bc17aeb17716ed7b872b8f0813f Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:00:09 +0000 Subject: [PATCH 1/2] feat(test): test get_event_loop --- tests/test_helpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_helpers.py diff --git a/tests/test_helpers.py b/tests/test_helpers.py new file mode 100644 index 00000000..3185b51c --- /dev/null +++ b/tests/test_helpers.py @@ -0,0 +1,10 @@ +from a_sync._helpers import get_event_loop + +def test_get_event_loop(): + assert get_event_loop() == asyncio.get_event_loop() + +def test_get_event_loop_in_thread(): + def task(): + assert get_event_loop() == asyncio.get_event_loop() + loop = get_event_loop() + loop.run_until_complete(loop.run_in_executor(None, task)) From 1d2e7ab7fc20e25710a4fedbbc370b1acef13811 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:00:09 +0000 Subject: [PATCH 2/2] fix(test): missing import --- tests/test_helpers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 3185b51c..3a22dd6c 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,5 +1,8 @@ +import asyncio + from a_sync._helpers import get_event_loop + def test_get_event_loop(): assert get_event_loop() == asyncio.get_event_loop()