Skip to content

Commit beb8d36

Browse files
committed
Create local cluster/client for all tests.
1 parent 5a2bc17 commit beb8d36

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
from pathlib import Path
22

33
import pytest
4+
from dask.distributed import Client, LocalCluster
45

56
TEST_DIR = Path(__file__).parent
67

78

9+
@pytest.fixture(scope="session", name="dask_client", autouse=True)
10+
def dask_client():
11+
"""Create a single client for use by all unit test cases."""
12+
cluster = LocalCluster(n_workers=1, threads_per_worker=1, dashboard_address=":0")
13+
client = Client(cluster)
14+
yield client
15+
client.close()
16+
cluster.close()
17+
18+
819
@pytest.fixture
920
def test_data_dir():
1021
return Path(TEST_DIR) / "data"

0 commit comments

Comments
 (0)