This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch jonathan/mirror-client-sourcedownloader-tidy
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 84911991a653612c43c3b886468e99e7884b3c90
Author: Jonathan Maw <[email protected]>
AuthorDate: Mon Jun 11 12:46:19 2018 +0100

    testutils: Make tar and zip sources copy successfully
    
    Unlike other sources, the directory that holds files is not the source.
    The file within that directory is the source.
    Removing subdir by default prevents extraneous "repo" subdirs being
    created.
---
 tests/testutils/repo/tar.py | 4 ++++
 tests/testutils/repo/zip.py | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tests/testutils/repo/tar.py b/tests/testutils/repo/tar.py
index ee6cb77..9882d6b 100644
--- a/tests/testutils/repo/tar.py
+++ b/tests/testutils/repo/tar.py
@@ -8,6 +8,10 @@ from .repo import Repo
 
 class Tar(Repo):
 
+    def __init__(self, directory, subdir):
+        # the repo is the file, not the dir it's in, so subdir is removed.
+        super().__init__(directory, '')
+
     def create(self, directory):
         tarball = os.path.join(self.repo, 'file.tar.gz')
 
diff --git a/tests/testutils/repo/zip.py b/tests/testutils/repo/zip.py
index 32a4698..bcacaf3 100644
--- a/tests/testutils/repo/zip.py
+++ b/tests/testutils/repo/zip.py
@@ -8,6 +8,10 @@ from .repo import Repo
 
 class Zip(Repo):
 
+    def __init__(self, directory, subdir):
+        # the repo is the file, not the dir it's in, so subdir is removed.
+        super().__init__(directory, '')
+
     def create(self, directory):
         archive = os.path.join(self.repo, 'file.zip')
 

Reply via email to