def test_zip_notebooks(): """Test generated zipfiles are not corrupt""" gallery_conf = build_test_configuration(examples_dir='examples') examples = downloads.list_downloadable_sources( gallery_conf['examples_dir']) zipfilepath = downloads.python_zip(examples, gallery_conf['gallery_dir']) zipf = zipfile.ZipFile(zipfilepath) check = zipf.testzip() if check: raise OSError("Bad file in zipfile: {0}".format(check))
def test_zip_notebooks(gallery_conf): """Test generated zipfiles are not corrupt.""" gallery_conf.update(examples_dir='examples') examples = downloads.list_downloadable_sources( gallery_conf['examples_dir']) zipfilepath = downloads.python_zip(examples, gallery_conf['gallery_dir']) zipf = zipfile.ZipFile(zipfilepath) check = zipf.testzip() if check: raise OSError("Bad file in zipfile: {0}".format(check))
def test_zip_notebooks(gallery_conf): """Test generated zipfiles are not corrupt.""" gallery_conf.update( examples_dir=os.path.join(gallery_conf['src_dir'], 'examples')) shutil.copytree( os.path.join(os.path.dirname(__file__), 'tinybuild', 'examples'), gallery_conf['examples_dir']) examples = downloads.list_downloadable_sources( gallery_conf['examples_dir']) zipfilepath = downloads.python_zip(examples, gallery_conf['gallery_dir']) zipf = zipfile.ZipFile(zipfilepath) check = zipf.testzip() assert not check, "Bad file in zipfile: {0}".format(check)