Fixed py3 issue of Verification component

Change-Id: I6764b4dd7f807f5e8d525dce6db3432ffbd9d54f
This commit is contained in:
Andrey Kurilin 2019-02-19 17:42:35 +02:00
parent 4e5890af43
commit 2fad5a9ef5
4 changed files with 16 additions and 3 deletions

View File

@ -17,6 +17,15 @@ Changelog
.. Release notes for existing releases are MUTABLE! If there is something that .. Release notes for existing releases are MUTABLE! If there is something that
was missed or can be improved, feel free to change it! was missed or can be improved, feel free to change it!
[unreleased]
------------
Fixed
~~~~~
* Python 3 issue of Verification component
* Docker README file
[1.4.0] - 2019-02-04 [1.4.0] - 2019-02-04
-------------------- --------------------

View File

@ -191,7 +191,8 @@ class VerifierManager(plugin.Plugin):
def _clone(self): def _clone(self):
"""Clone a repo and switch to a certain version.""" """Clone a repo and switch to a certain version."""
source = self.verifier.source or self._meta_get("default_repo") source = self.verifier.source or self._meta_get("default_repo")
if not URL_RE.match(source) and not os.path.exists(source): if not source or (
not URL_RE.match(source) and not os.path.exists(source)):
raise exceptions.RallyException("Source path '%s' is not valid." raise exceptions.RallyException("Source path '%s' is not valid."
% source) % source)

View File

@ -58,8 +58,9 @@ def check_output(*args, **kwargs):
LOG.error("Error output: '%s'" % encodeutils.safe_decode(exc.output)) LOG.error("Error output: '%s'" % encodeutils.safe_decode(exc.output))
raise raise
output = encodeutils.safe_decode(output)
if output and debug_output: if output and debug_output:
LOG.debug("Subprocess output: '%s'" % encodeutils.safe_decode(output)) LOG.debug("Subprocess output: '%s'" % output)
return output return output

View File

@ -40,9 +40,11 @@ class UtilsTestCase(test.TestCase):
def test_check_output(self, mock_check_output, mock_log, def test_check_output(self, mock_check_output, mock_log,
mock_encodeutils): mock_encodeutils):
self.assertEqual(mock_check_output.return_value, self.assertEqual(mock_encodeutils.safe_decode.return_value,
utils.check_output()) utils.check_output())
self.assertFalse(mock_log.error.called) self.assertFalse(mock_log.error.called)
mock_encodeutils.safe_decode.assert_called_once_with(
mock_check_output.return_value)
mock_check_output.side_effect = subprocess.CalledProcessError(1, None) mock_check_output.side_effect = subprocess.CalledProcessError(1, None)
self.assertRaises(subprocess.CalledProcessError, utils.check_output) self.assertRaises(subprocess.CalledProcessError, utils.check_output)