File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -179,3 +179,31 @@ async def test_prepare_dataset_tar_no_path_with_overwrite(httpserver):
179179 with open (expected_directory / "1.txt" ) as f :
180180 assert "I am the first test file" in f .read ()
181181 expected_directory .unlink ()
182+
183+
184+ @pytest .mark .asyncio
185+ async def test_prepare_dataset_zip_no_path_with_overwrite (httpserver ):
186+ url = "/test.zip"
187+ expected_directory = Path ("test" )
188+ try :
189+ shutil .rmtree (expected_directory ) # clean up any previous test
190+ except FileNotFoundError as e :
191+ print (e )
192+ pass
193+
194+ with open ("tests/test.zip" , "rb" ) as expected_data :
195+ httpserver .expect_request (url ).respond_with_data (expected_data )
196+ await skillsnetwork .prepare_dataset (httpserver .url_for (url ))
197+
198+ assert os .path .isdir (expected_directory )
199+ with open (expected_directory / "1.txt" ) as f :
200+ assert "I am the first test file" in f .read ()
201+ httpserver .clear ()
202+
203+ with open ("tests/test.zip" , "rb" ) as expected_data :
204+ httpserver .expect_request (url ).respond_with_data (expected_data )
205+ await skillsnetwork .prepare_dataset (httpserver .url_for (url ), overwrite = True )
206+ assert os .path .isdir (expected_directory )
207+ with open (expected_directory / "1.txt" ) as f :
208+ assert "I am the first test file" in f .read ()
209+ expected_directory .unlink ()
You can’t perform that action at this time.
0 commit comments