Fix flaky test_WorkerPlugin_overwrite
+import asyncio
+
import pytest
from distributed import Worker, WorkerPlugin
@@ -274,6 +276,9 @@ async def test_WorkerPlugin_overwrite(c, s, w):
await c.submit(inc, 0)
assert w.foo == 123
+ while s.tasks or w.tasks:
+ await asyncio.sleep(0.01)
+
class MyCustomPlugin(WorkerPlugin):
name = "custom"
