|
|
@@ -4213,21 +4213,20 @@ class TestSlicerProxyManager:
|
|
|
)
|
|
|
|
|
|
# Mock asyncio.create_task and asyncio.gather to prevent actual
|
|
|
- # server start. Close every coroutine handed to gather — otherwise
|
|
|
- # the ~110 run_with_logging() coros built inside start() are
|
|
|
- # garbage-collected unfinalized and surface later as
|
|
|
- # PytestUnraisableExceptionWarning at random in other tests.
|
|
|
- async def _close_pending(*coros, **_):
|
|
|
- for c in coros:
|
|
|
- if asyncio.iscoroutine(c):
|
|
|
- c.close()
|
|
|
+ # server start. Close every coroutine handed to create_task (gather
|
|
|
+ # only sees the stand-in tasks) — otherwise the ~110
|
|
|
+ # run_with_logging() coros built inside start() are garbage-collected
|
|
|
+ # unfinalized and surface later as PytestUnraisableExceptionWarning at
|
|
|
+ # random in other tests.
|
|
|
+ def _close_and_stand_in(coro, **_):
|
|
|
+ coro.close()
|
|
|
+ return MagicMock()
|
|
|
|
|
|
with (
|
|
|
- patch("asyncio.create_task") as mock_create_task,
|
|
|
- patch("asyncio.gather", side_effect=_close_pending),
|
|
|
+ patch("asyncio.create_task", side_effect=_close_and_stand_in),
|
|
|
+ patch("asyncio.gather", new=AsyncMock()),
|
|
|
patch.object(SlicerProxyManager, "_log_activity"),
|
|
|
):
|
|
|
- mock_create_task.return_value = MagicMock()
|
|
|
await mgr.start()
|
|
|
|
|
|
# FTP, FileTransfer, RTSP should be TCPProxy (transparent)
|