summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-06-11 12:46:19 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-06-26 17:50:36 +0100
commit007d9c6e04a2afb6b2d8ac57e43653baa310262e (patch)
tree5aa4010555c2c9fb79dbe95bb91edc5040dc42f0
parent714bfe7a56de04c4921fba9f9352a7ba7ad5e859 (diff)
downloadbuildstream-007d9c6e04a2afb6b2d8ac57e43653baa310262e.tar.gz
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.
-rw-r--r--tests/testutils/repo/tar.py4
-rw-r--r--tests/testutils/repo/zip.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/testutils/repo/tar.py b/tests/testutils/repo/tar.py
index ee6cb77b3..9882d6be4 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 32a46984e..bcacaf30f 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')