diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2011-12-09 14:46:37 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2011-12-09 15:06:26 +0000 |
commit | 396e990faa49359ed440456a01d5a2815e6396e7 (patch) | |
tree | 22495046a817352346b57edf37d196abef4a3176 /morphlib/bins_tests.py | |
parent | a2634251b06bdf0b917d21b458e868722de7c541 (diff) | |
download | morph-396e990faa49359ed440456a01d5a2815e6396e7.tar.gz |
Fix tests to reflect changes
bins now takes an Execute, so the test needed to be changed to also pass one
Execute had to be changed to ignore a statement from coverage
Also fixed Execute.runv not outputting its error. I think it is not logged
this way, but it does get output like it was before.
Also check no longer runs cmdtest from the home directory.
Diffstat (limited to 'morphlib/bins_tests.py')
-rw-r--r-- | morphlib/bins_tests.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py index 171b9652..6fe48aa7 100644 --- a/morphlib/bins_tests.py +++ b/morphlib/bins_tests.py @@ -56,6 +56,7 @@ def recursive_lstat(root): class ChunkTests(unittest.TestCase): def setUp(self): + self.ex = morphlib.execute.Execute('.', lambda s: None) self.tempdir = tempfile.mkdtemp() self.instdir = os.path.join(self.tempdir, 'inst') self.chunk_file = os.path.join(self.tempdir, 'chunk') @@ -79,7 +80,8 @@ class ChunkTests(unittest.TestCase): def test_empties_everything(self): self.populate_instdir() - morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['.']) + morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['.'], + self.ex) empty = os.path.join(self.tempdir, 'empty') os.mkdir(empty) self.assertEqual([x for x,y in recursive_lstat(self.instdir)], ['.']) @@ -87,16 +89,19 @@ class ChunkTests(unittest.TestCase): def test_creates_and_unpacks_chunk_exactly(self): self.populate_instdir() orig_files = recursive_lstat(self.instdir) - morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['.']) + morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['.'], + self.ex) os.mkdir(self.unpacked) - morphlib.bins.unpack_binary(self.chunk_file, self.unpacked) + morphlib.bins.unpack_binary(self.chunk_file, self.unpacked, self.ex, + as_fakeroot=True) self.assertEqual(orig_files, recursive_lstat(self.unpacked)) def test_uses_only_matching_names(self): self.populate_instdir() - morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['bin']) + morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['bin'], + self.ex) os.mkdir(self.unpacked) - morphlib.bins.unpack_binary(self.chunk_file, self.unpacked) + morphlib.bins.unpack_binary(self.chunk_file, self.unpacked, self.ex) self.assertEqual([x for x,y in recursive_lstat(self.unpacked)], ['.', 'bin', 'bin/foo']) self.assertEqual([x for x,y in recursive_lstat(self.instdir)], @@ -105,6 +110,7 @@ class ChunkTests(unittest.TestCase): class StratumTests(unittest.TestCase): def setUp(self): + self.ex = morphlib.execute.Execute('.', lambda s: None) self.tempdir = tempfile.mkdtemp() self.instdir = os.path.join(self.tempdir, 'inst') self.stratum_file = os.path.join(self.tempdir, 'stratum') @@ -119,9 +125,10 @@ class StratumTests(unittest.TestCase): def test_creates_and_unpacks_stratum_exactly(self): self.populate_instdir() - morphlib.bins.create_stratum(self.instdir, self.stratum_file) + morphlib.bins.create_stratum(self.instdir, self.stratum_file, self.ex) os.mkdir(self.unpacked) - morphlib.bins.unpack_binary(self.stratum_file, self.unpacked) + morphlib.bins.unpack_binary(self.stratum_file, self.unpacked, self.ex, + as_fakeroot=True) self.assertEqual(recursive_lstat(self.instdir), recursive_lstat(self.unpacked)) |