Skip to content

Commit 0783d91

Browse files
committed
Fix several "no active event loop" warnings
* Go back to IOLoop(make_current=False) to avoid proactively starting the loop when the underlying asyncio system is not ready. * Turn streamz/tests/test_core.py::test_timed_window_timedelta into a coroutine as the underlying event loop needs to be live.
1 parent 0b0f41a commit 0783d91

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

streamz/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_io_loop(asynchronous=None):
5151
return client.loop
5252

5353
if not _io_loops:
54-
loop = IOLoop()
54+
loop = IOLoop(make_current=False)
5555
thread = threading.Thread(target=loop.start)
5656
thread.daemon = True
5757
thread.start()

streamz/tests/test_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ def test_timed_window_metadata():
444444
]
445445

446446

447-
def test_timed_window_timedelta(clean): # noqa: F811
447+
@pytest.mark.asyncio
448+
async def test_timed_window_timedelta(clean): # noqa: F811
448449
pytest.importorskip('pandas')
449450
source = Stream(asynchronous=True)
450451
a = source.timed_window('10ms')

streamz/utils_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def double(x):
4343

4444
@contextmanager
4545
def pristine_loop():
46-
loop = IOLoop()
46+
loop = IOLoop(make_current=False)
4747
try:
4848
yield loop
4949
finally:

0 commit comments

Comments
 (0)