Skip to content

Commit 2ba4b41

Browse files
committed
use get_test()
1 parent e18ca2e commit 2ba4b41

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

distributed/protocol/tests/test_to_pickle.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import dask.config
77
from dask.highlevelgraph import HighLevelGraph, MaterializedLayer
88

9-
from distributed.client import Client
9+
from distributed.client import Client, _del_global_client
1010
from distributed.protocol import dumps, loads
1111
from distributed.protocol.serialize import ToPickle
1212
from distributed.scheduler import Scheduler
1313
from distributed.utils import CancelledError
14-
from distributed.utils_test import captured_logger
14+
from distributed.utils_test import captured_logger, gen_test
1515
from distributed.worker import Worker
1616

1717

@@ -56,7 +56,7 @@ def __dask_distributed_unpack__(cls, state, *args, **kwargs):
5656

5757
@pytest.mark.parametrize("allow_pickle", [False, True])
5858
@pytest.mark.parametrize("protocol", ["tcp", "inproc"])
59-
@pytest.mark.asyncio
59+
@gen_test()
6060
async def test_non_msgpack_serializable(allow_pickle, protocol):
6161
async def client_run(log, a, c):
6262
a = NonMsgPackSerializableLayer({"x": 42})
@@ -82,3 +82,6 @@ async def client_run(log, a, c):
8282
async with Worker(s.listeners[0].contact_address) as a:
8383
async with Client(s.address, asynchronous=True) as c:
8484
await client_run(log, a, c)
85+
# In order to avoid a timeout in gen_test() when the Scheduler crashes
86+
# because of `allow_pickle=False`, we delete the client explicitly.
87+
_del_global_client(c)

0 commit comments

Comments
 (0)