diff options
-rwxr-xr-x | check | 2 | ||||
-rw-r--r-- | morphlib/bins_tests.py | 21 | ||||
-rw-r--r-- | morphlib/execute.py | 8 |
3 files changed, 19 insertions, 12 deletions
@@ -20,4 +20,4 @@ set -e python setup.py clean check -$HOME/cmdtest/cmdtest/cmdtest -c ./morph tests +cmdtest -c ./morph tests 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)) diff --git a/morphlib/execute.py b/morphlib/execute.py index 5e7c4470..b502cb11 100644 --- a/morphlib/execute.py +++ b/morphlib/execute.py @@ -41,7 +41,7 @@ class Execute(object): self.msg = msg self._fakeroot_session = None - def __del__(self): + def __del__(self): # pragma: no cover try: object.__del__(self) except AttributeError: @@ -101,10 +101,10 @@ class Execute(object): ''' if 'stdout' not in kwargs: kwargs['stdout'] = subprocess.PIPE - if feed_stdin is not None and 'stdin' not in kwargs: - kwargs['stdin'] = subprocess.PIPE + if feed_stdin is not None and 'stdin' not in kwargs: + kwargs['stdin'] = subprocess.PIPE # pragma: no cover if 'stderr' not in kwargs: - kwargs['stderr'] = subprocess.PIPE + kwargs['stderr'] = subprocess.STDOUT if 'cwd' not in kwargs: kwargs['cwd'] = self.dirname if 'env' not in kwargs: |