Fix emerge testcases

During the refactoring of the depends module
I74ebd432d8e1ab8b3433f0f55d5dfe3535019911
it was found that two test cases for emerge
used the wrong type as a return type in the
CalledProcessError (str instead of bytes).

This patch fixes this and also adds a check that the
appropriate operations can be executed also for emerge.

Change-Id: I127e72cbcefaef12f28f5eb986cdcc769d033bf7
Signed-off-by: Andreas Florath <andreas@florath.net>
This commit is contained in:
Andreas Florath 2017-04-26 16:44:19 +00:00 committed by Sorin Sbarnea
parent bf85560fd0
commit 92bb971784
2 changed files with 6 additions and 2 deletions

View File

@ -507,6 +507,10 @@ class Emerge(Platform):
['equery', 'l', '--format=\'$version\'', pkg_name],
stderr=subprocess.STDOUT).decode(getpreferredencoding(False))
except subprocess.CalledProcessError as e:
# The output is currently not used in the test cases.
# Nevertheless the next statement checks if the given
# parameter has the correct type.
e.output.decode(getpreferredencoding(False))
if e.returncode == 3:
return None
raise

View File

@ -655,7 +655,7 @@ class TestEmerge(TestCase):
platform = Emerge()
def _side_effect_raise(*args, **kwargs):
raise subprocess.CalledProcessError(3, [], '')
raise subprocess.CalledProcessError(3, [], b'')
mocked_checkoutput = self.useFixture(
fixtures.MockPatchObject(subprocess, 'check_output')).mock
@ -670,7 +670,7 @@ class TestEmerge(TestCase):
platform = Emerge()
def _side_effect_raise(*args, **kwargs):
raise subprocess.CalledProcessError(3, [], '')
raise subprocess.CalledProcessError(3, [], b'')
mocked_checkoutput = self.useFixture(
fixtures.MockPatchObject(subprocess, 'check_output')).mock