|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class TestSmallExample:
|
| 12 | + data_path = "tests/data/vcf/sample.vcf.gz" |
| 13 | + |
12 | 14 | @pytest.fixture(scope="class")
|
13 | 15 | def ds(self, tmp_path_factory):
|
14 |
| - path = "tests/data/vcf/sample.vcf.gz" |
15 | 16 | out = tmp_path_factory.mktemp("data") / "example.vcf.zarr"
|
16 |
| - vcf.convert_vcf([path], out) |
| 17 | + vcf.convert_vcf([self.data_path], out) |
17 | 18 | return sg.load_dataset(out)
|
18 | 19 |
|
19 | 20 | def test_filters(self, ds):
|
@@ -243,9 +244,10 @@ def test_no_genotypes(self, ds, tmp_path):
|
243 | 244 | def test_chunk_size(
|
244 | 245 | self, ds, tmp_path, chunk_length, chunk_width, y_chunks, x_chunks
|
245 | 246 | ):
|
246 |
| - path = "tests/data/vcf/sample.vcf.gz" |
247 | 247 | 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 | + ) |
249 | 251 | ds2 = sg.load_dataset(out)
|
250 | 252 | # print(ds2.call_genotype.values)
|
251 | 253 | # print(ds.call_genotype.values)
|
@@ -273,6 +275,15 @@ def test_chunk_size(
|
273 | 275 | assert ds2.filter_id.chunks == ((3,),)
|
274 | 276 | assert ds2.sample_id.chunks == (x_chunks,)
|
275 | 277 |
|
| 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 | + |
276 | 287 |
|
277 | 288 | @pytest.mark.parametrize(
|
278 | 289 | "name",
|
|
0 commit comments