From 92bb971784004fcecdbd52b8b4c39049bb6f6c9f Mon Sep 17 00:00:00 2001 From: Andreas Florath Date: Wed, 26 Apr 2017 16:44:19 +0000 Subject: [PATCH] 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 --- bindep/depends.py | 4 ++++ bindep/tests/test_depends.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bindep/depends.py b/bindep/depends.py index 244700d..b25bf86 100644 --- a/bindep/depends.py +++ b/bindep/depends.py @@ -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 diff --git a/bindep/tests/test_depends.py b/bindep/tests/test_depends.py index 31f227f..faede74 100644 --- a/bindep/tests/test_depends.py +++ b/bindep/tests/test_depends.py @@ -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