From 396e990faa49359ed440456a01d5a2815e6396e7 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 9 Dec 2011 14:46:37 +0000 Subject: 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. --- morphlib/bins_tests.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'morphlib/bins_tests.py') 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)) -- cgit v1.2.1