commit edebe6a4a42bae99a1819898b14bb0951cfe6b8b Author: Valentin Lorentz Date: Mon Nov 5 14:54:06 2018 +0100 Remove testrepo.zip. diff --git a/requirements-swh.txt b/requirements-swh.txt index dbe81b0..c62d405 100644 --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,5 +1,5 @@ swh.core >= 0.0.7 -swh.loader.core >= 0.0.36 +swh.loader.core >= 0.0.32 swh.model >= 0.0.27 swh.scheduler >= 0.0.14 swh.storage >= 0.0.108 diff --git a/swh/loader/git/tests/resources/testrepo.zip b/swh/loader/git/tests/resources/testrepo.zip deleted file mode 100644 index ac9bc3e..0000000 Binary files a/swh/loader/git/tests/resources/testrepo.zip and /dev/null differ diff --git a/swh/loader/git/tests/test_loader.py b/swh/loader/git/tests/test_loader.py index ef135d4..55380bc 100644 --- a/swh/loader/git/tests/test_loader.py +++ b/swh/loader/git/tests/test_loader.py @@ -4,6 +4,8 @@ # See top-level LICENSE file for more information import os.path +import zipfile +import tempfile import subprocess from swh.loader.git.loader import GitLoader, GitLoaderFromArchive @@ -167,9 +169,28 @@ class BaseZipGitLoaderTest(BaseGitLoaderTest): """ def setUp(self): - super().setUp('testrepo.zip', False) + super().setUp('testrepo.tgz', True) + self._zip_file = tempfile.NamedTemporaryFile('ab', suffix='.zip') + dest_dir = os.path.normpath(self.destination_path) + '/' + with zipfile.ZipFile(self._zip_file, 'a') as zip_writer: + for root, dirs, files in os.walk(dest_dir): + assert root.startswith(dest_dir) + relative_root = os.path.join( + 'testrepo', + root[len(dest_dir):]) + for file_ in files: + zip_writer.write( + filename=os.path.join(root, file_), + arcname=os.path.join(relative_root, file_)) + self.destination_path = self._zip_file.name + self.tmp_root_path = None + self.repo_url = 'file://' + self.destination_path self.loader = GitLoaderFromArchiveNoStorage() + def tearDown(self): + self._zip_file.close() + super().tearDown() + def load(self): return self.loader.load( origin_url=self.repo_url,