diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-11-29 16:08:20 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-11-29 16:08:20 +0000 |
commit | c859d70d86423a52bc7053abf64e9ca21f62a487 (patch) | |
tree | 8a714de08c4a6ac12f37fd840ac58c70c5f9b8da /morphlib/stagingarea_tests.py | |
parent | 3085a672d1e8b5177be33f0463385de72a0ef5bf (diff) | |
parent | 0b4655904bd0293055cd7e150d89124c2a32e6b9 (diff) | |
download | morph-c859d70d86423a52bc7053abf64e9ca21f62a487.tar.gz |
Merge branch 'liw/hardlink-staging-area-pre-rebase'
This is based on, and incorporates, Joe Burmeister's changes to fill
staging areas using hardlinking, for speed reasons. I have reformatted
the code a bit, and fixed it to pass the test suite, and fixed a bug
in how commands are run in the staging area chroot (preserving the
environment).
Diffstat (limited to 'morphlib/stagingarea_tests.py')
-rw-r--r-- | morphlib/stagingarea_tests.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py index 3230b9e3..15131272 100644 --- a/morphlib/stagingarea_tests.py +++ b/morphlib/stagingarea_tests.py @@ -14,6 +14,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import cliapp import os import shutil import tarfile @@ -31,14 +32,28 @@ class FakeSource(object): } +class FakeApplication(object): + + def __init__(self, cachedir): + self.settings = { + 'cachedir': cachedir, + } + + def runcmd(self, *args, **kwargs): + cliapp.runcmd(*args, **kwargs) + + class StagingAreaTests(unittest.TestCase): def setUp(self): self.tempdir = tempfile.mkdtemp() + self.cachedir = os.path.join(self.tempdir, 'cachedir') + os.mkdir(self.cachedir) + os.mkdir(os.path.join(self.cachedir, 'artifacts')) self.staging = os.path.join(self.tempdir, 'staging') self.created_dirs = [] - self.sa = morphlib.stagingarea.StagingArea(object(), self.staging, - self.staging) + self.sa = morphlib.stagingarea.StagingArea( + FakeApplication(self.cachedir), self.staging, self.staging) def tearDown(self): shutil.rmtree(self.tempdir) |