@@ -116,7 +116,7 @@ def test_vcf_dexplode_init_compressor(self, mocked, tmp_path, compressor):
116116 runner = ct .CliRunner (mix_stderr = False )
117117 result = runner .invoke (
118118 cli .vcf2zarr_main ,
119- f"dexplode-init { self .vcf_path } { icf_path } 1 -C { compressor } " ,
119+ f"dexplode-init { self .vcf_path } { icf_path } -n 1 -C { compressor } " ,
120120 catch_exceptions = False ,
121121 )
122122 assert result .exit_code == 0
@@ -294,7 +294,7 @@ def test_vcf_dexplode_init(self, mocked, tmp_path, progress, flag):
294294 icf_path = tmp_path / "icf"
295295 result = runner .invoke (
296296 cli .vcf2zarr_main ,
297- f"dexplode-init { self .vcf_path } { icf_path } 5 { flag } " ,
297+ f"dexplode-init { self .vcf_path } { icf_path } -n 5 { flag } " ,
298298 catch_exceptions = False ,
299299 )
300300 assert result .exit_code == 0
@@ -309,7 +309,7 @@ def test_vcf_dexplode_init(self, mocked, tmp_path, progress, flag):
309309 ** args ,
310310 )
311311
312- @pytest .mark .parametrize ("num_partitions" , ["-- - 1" , "0" , "asdf" , "1.112" ])
312+ @pytest .mark .parametrize ("num_partitions" , ["-1" , "0" , "asdf" , "1.112" ])
313313 @mock .patch ("bio2zarr.vcf2zarr.explode_init" , return_value = 5 )
314314 def test_vcf_dexplode_init_bad_num_partitions (
315315 self , mocked , tmp_path , num_partitions
@@ -318,11 +318,24 @@ def test_vcf_dexplode_init_bad_num_partitions(
318318 icf_path = tmp_path / "icf"
319319 result = runner .invoke (
320320 cli .vcf2zarr_main ,
321- f"dexplode-init { self .vcf_path } { icf_path } { num_partitions } " ,
321+ f"dexplode-init { self .vcf_path } { icf_path } -n { num_partitions } " ,
322322 catch_exceptions = False ,
323323 )
324324 assert result .exit_code == 2
325- assert "Invalid value for 'NUM_PARTITIONS'" in result .stderr
325+ assert "Invalid value for '-n'" in result .stderr
326+ mocked .assert_not_called ()
327+
328+ @mock .patch ("bio2zarr.vcf2zarr.explode_init" , return_value = 5 )
329+ def test_vcf_dexplode_init_no_partitions (self , mocked , tmp_path ):
330+ runner = ct .CliRunner (mix_stderr = False )
331+ icf_path = tmp_path / "icf"
332+ result = runner .invoke (
333+ cli .vcf2zarr_main ,
334+ f"dexplode-init { self .vcf_path } { icf_path } " ,
335+ catch_exceptions = False ,
336+ )
337+ assert result .exit_code == 2
338+ assert "-n/--num-partitions must currently be specified" in result .stderr
326339 mocked .assert_not_called ()
327340
328341 @mock .patch ("bio2zarr.vcf2zarr.explode_partition" )
@@ -457,7 +470,7 @@ def test_dencode_init(self, mocked, tmp_path, progress, flag):
457470 runner = ct .CliRunner (mix_stderr = False )
458471 result = runner .invoke (
459472 cli .vcf2zarr_main ,
460- f"dencode-init { icf_path } { zarr_path } 10 { flag } " ,
473+ f"dencode-init { icf_path } { zarr_path } -n 10 { flag } " ,
461474 catch_exceptions = False ,
462475 )
463476 assert result .exit_code == 0
@@ -472,6 +485,21 @@ def test_dencode_init(self, mocked, tmp_path, progress, flag):
472485 ** args ,
473486 )
474487
488+ @mock .patch ("bio2zarr.vcf2zarr.encode_init" , return_value = 5 )
489+ def test_vcf_dencode_init_no_partitions (self , mocked , tmp_path ):
490+ runner = ct .CliRunner (mix_stderr = False )
491+ icf_path = tmp_path / "icf"
492+ icf_path .mkdir ()
493+ zarr_path = tmp_path / "zarr"
494+ result = runner .invoke (
495+ cli .vcf2zarr_main ,
496+ f"dencode-init { icf_path } { zarr_path } " ,
497+ catch_exceptions = False ,
498+ )
499+ assert result .exit_code == 2
500+ assert "-n/--num-partitions must currently be specified" in result .stderr
501+ mocked .assert_not_called ()
502+
475503 @mock .patch ("bio2zarr.vcf2zarr.encode_partition" )
476504 def test_vcf_dencode_partition (self , mocked , tmp_path ):
477505 runner = ct .CliRunner (mix_stderr = False )
@@ -601,7 +629,7 @@ def test_dexplode(self, tmp_path, one_based):
601629 runner = ct .CliRunner (mix_stderr = False )
602630 result = runner .invoke (
603631 cli .vcf2zarr_main ,
604- f"dexplode-init { self .vcf_path } { icf_path } 5 --json -Q" ,
632+ f"dexplode-init { self .vcf_path } { icf_path } -n 5 --json -Q" ,
605633 catch_exceptions = False ,
606634 )
607635 assert result .exit_code == 0
@@ -678,7 +706,7 @@ def test_dencode(self, tmp_path, one_based):
678706 assert result .exit_code == 0
679707 result = runner .invoke (
680708 cli .vcf2zarr_main ,
681- f"dencode-init { icf_path } { zarr_path } 5 --variants-chunk-size=3 --json" ,
709+ f"dencode-init { icf_path } { zarr_path } -n 5 --variants-chunk-size=3 --json" ,
682710 catch_exceptions = False ,
683711 )
684712 assert result .exit_code == 0
0 commit comments