Skip to content

Commit eea9002

Browse files
authored
(fix): force dask cluster tests to be run in same process (#1932)
* (fix): group `dask` tests together on same process * (fix): use `pytest-xdist` by default
1 parent a4d707d commit eea9002

5 files changed

Lines changed: 8 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Home-page = "https://github.com/scverse/anndata"
6161
dev = [
6262
# runtime dev version generation
6363
"hatch-vcs",
64-
"anndata[dev-doc,dev-test]",
64+
"anndata[dev-doc,test]",
6565
]
6666
doc = [
6767
"sphinx>=8.2.1",
@@ -91,20 +91,20 @@ test = [
9191
"pytest-randomly",
9292
"pytest-memray",
9393
"pytest-mock",
94+
"pytest-xdist[psutil]",
9495
"filelock",
9596
"matplotlib",
9697
"scikit-learn",
9798
"openpyxl",
9899
"joblib",
99100
"boltons",
100101
"scanpy>=1.10",
101-
"httpx", # For data downloading
102+
"httpx", # For data downloading
102103
"dask[distributed]",
103104
"awkward>=2.3",
104105
"pyarrow",
105106
"anndata[dask]",
106107
]
107-
dev-test = [ "pytest-xdist[psutil]" ] # local test speedups
108108
gpu = [ "cupy" ]
109109
cu12 = [ "cupy-cuda12x" ]
110110
cu11 = [ "cupy-cuda11x" ]
@@ -144,6 +144,7 @@ addopts = [
144144
"--doctest-modules",
145145
"--pyargs",
146146
"-ptesting.anndata._pytest",
147+
"--dist=loadgroup",
147148
]
148149
filterwarnings = [
149150
"ignore::anndata._warnings.OldFormatWarning",

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from dask.base import normalize_seq
1414
else:
1515
from dask.tokenize import normalize_seq
16+
1617
from filelock import FileLock
1718
from scipy import sparse
1819

tests/lazy/test_concat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def test_concat_to_memory_var(
214214
stores_for_concat[store_idx].reset_key_trackers()
215215

216216

217+
@pytest.mark.xdist_group("dask")
217218
def test_concat_data_with_cluster_to_memory(
218219
adata_remote: AnnData, join: Join_T, local_cluster_addr: str
219220
) -> None:

tests/test_dask.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def test_dask_write(adata, tmp_path, diskfmt):
110110
assert isinstance(orig.varm["a"], DaskArray)
111111

112112

113+
@pytest.mark.xdist_group("dask")
113114
def test_dask_distributed_write(
114115
adata: AnnData,
115116
tmp_path: Path,

tests/test_io_elementwise.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def test_read_lazy_subsets_nd_dask(store, n_dims, chunks):
336336
assert_equal(X_from_disk[index], X_dask_from_disk[index])
337337

338338

339+
@pytest.mark.xdist_group("dask")
339340
def test_read_lazy_h5_cluster(
340341
sparse_format: Literal["csr", "csc"], tmp_path: Path, local_cluster_addr: str
341342
) -> None:

0 commit comments

Comments
 (0)