Skip to content

Commit 4dfc75e

Browse files
Run some tests using sync worker
1 parent 5abbfad commit 4dfc75e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/test_vcf.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010

1111
class TestSmallExample:
12+
data_path = "tests/data/vcf/sample.vcf.gz"
13+
1214
@pytest.fixture(scope="class")
1315
def ds(self, tmp_path_factory):
14-
path = "tests/data/vcf/sample.vcf.gz"
1516
out = tmp_path_factory.mktemp("data") / "example.vcf.zarr"
16-
vcf.convert_vcf([path], out)
17+
vcf.convert_vcf([self.data_path], out)
1718
return sg.load_dataset(out)
1819

1920
def test_filters(self, ds):
@@ -243,9 +244,10 @@ def test_no_genotypes(self, ds, tmp_path):
243244
def test_chunk_size(
244245
self, ds, tmp_path, chunk_length, chunk_width, y_chunks, x_chunks
245246
):
246-
path = "tests/data/vcf/sample.vcf.gz"
247247
out = tmp_path / "example.vcf.zarr"
248-
vcf.convert_vcf([path], out, chunk_length=chunk_length, chunk_width=chunk_width)
248+
vcf.convert_vcf(
249+
[self.data_path], out, chunk_length=chunk_length, chunk_width=chunk_width
250+
)
249251
ds2 = sg.load_dataset(out)
250252
# print(ds2.call_genotype.values)
251253
# print(ds.call_genotype.values)
@@ -273,6 +275,15 @@ def test_chunk_size(
273275
assert ds2.filter_id.chunks == ((3,),)
274276
assert ds2.sample_id.chunks == (x_chunks,)
275277

278+
@pytest.mark.parametrize("worker_processes", [0, 1, 2])
279+
def test_worker_processes(self, ds, tmp_path, worker_processes):
280+
out = tmp_path / "example.vcf.zarr"
281+
vcf.convert_vcf(
282+
[self.data_path], out, chunk_length=3, worker_processes=worker_processes
283+
)
284+
ds2 = sg.load_dataset(out)
285+
xt.assert_equal(ds, ds2)
286+
276287

277288
@pytest.mark.parametrize(
278289
"name",

0 commit comments

Comments
 (0)