@@ -634,7 +634,7 @@ def test_write_subcrate(test_data_dir, tmpdir, to_zip):
634634 crate = ROCrate (test_data_dir / "crate_with_subcrates" , load_subcrates = True )
635635 out_path = tmpdir / "ro_crate_out"
636636 if to_zip :
637- zip_path = tmpdir / 'ro_crate_out.crate. zip'
637+ zip_path = tmpdir / 'ro_crate_out.zip'
638638 crate .write_zip (zip_path )
639639 with zipfile .ZipFile (zip_path , "r" ) as zf :
640640 zf .extractall (out_path )
@@ -651,7 +651,8 @@ def test_write_subcrate(test_data_dir, tmpdir, to_zip):
651651 assert (out_path / "subcrate" / "subsubcrate" / "ro-crate-metadata.json" ).is_file ()
652652
653653
654- def test_subcrates_creation (test_data_dir , tmpdir ):
654+ @pytest .mark .parametrize ("to_zip" , [False , True ])
655+ def test_subcrates_creation (test_data_dir , tmpdir , to_zip ):
655656 crate = ROCrate ()
656657 crate .add_file (test_data_dir / "sample_file.txt" )
657658 subcrate = crate .add_subcrate (dest_path = "subcrate/" )
@@ -671,7 +672,14 @@ def test_subcrates_creation(test_data_dir, tmpdir):
671672 assert subcrate_crate .get ("subsubcrate/setup.cfg" ) is subsubf
672673
673674 out_path = tmpdir / "ro_crate_out"
674- crate .write (out_path )
675+ if to_zip :
676+ zip_path = tmpdir / 'ro_crate_out.zip'
677+ crate .write_zip (zip_path )
678+ with zipfile .ZipFile (zip_path , "r" ) as zf :
679+ zf .extractall (out_path )
680+ else :
681+ crate .write (out_path )
682+
675683 assert (out_path / "ro-crate-metadata.json" ).is_file ()
676684 assert (out_path / "sample_file.txt" ).is_file ()
677685 assert (out_path / "subcrate" / "ro-crate-metadata.json" ).is_file ()
0 commit comments