summaryrefslogtreecommitdiffstats
path: root/dovetail/tests
diff options
context:
space:
mode:
authorPanagiotis Karalis <panos.pkaralis@gmail.com>2019-09-17 11:55:58 +0300
committerPanagiotis Karalis <panos.pkaralis@gmail.com>2019-09-18 12:22:21 +0300
commit9b8d8fcc9f4f191374f730b13fcb0ce18905864c (patch)
tree9b6e11497df6ef9028577881afc8bfe175342ee2 /dovetail/tests
parent005d868d68dbb0e70b3f92a685ea269c4f646fd7 (diff)
Fault fixing for cmd_exec util method
When the 'dovetail run' command is assigned, the error "TypeError: must be str, not bytes" is appeared. Due to a different handling of strings in the Python3, this error is appeared during of command execution (i.e. exec_cmd method). Each piece of the string should be decoded, before it will be appended to the rest one. Signed-off-by: Panagiotis Karalis <panos.pkaralis@gmail.com> Change-Id: I65629f3f76cc3e44f3926a744d00791ef588d2aa
Diffstat (limited to 'dovetail/tests')
-rw-r--r--dovetail/tests/unit/utils/test_dovetail_utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/dovetail/tests/unit/utils/test_dovetail_utils.py b/dovetail/tests/unit/utils/test_dovetail_utils.py
index 5b403a5c..d912aa84 100644
--- a/dovetail/tests/unit/utils/test_dovetail_utils.py
+++ b/dovetail/tests/unit/utils/test_dovetail_utils.py
@@ -1233,9 +1233,9 @@ class DovetailUtilsTesting(unittest.TestCase):
subp_stdout = Mock()
subprocess_obj.stdout = subp_stdout
subprocess_obj.wait.return_value = 0
- subp_stdout.readline.side_effect = [cmd_output, '']
+ subp_stdout.readline.side_effect = [cmd_output.encode()]
- expected = (0, 'line')
+ expected = (0, "b'line'")
result = dovetail_utils.exec_cmd(
cmd, logger=logger, exit_on_error=True, info=False,
exec_msg_on=True, err_msg='', verbose=verbose,
@@ -1276,7 +1276,7 @@ class DovetailUtilsTesting(unittest.TestCase):
subp_stdout = Mock()
subprocess_obj.stdout = subp_stdout
subprocess_obj.wait.return_value = 1
- subp_stdout.readline.side_effect = [cmd_output, '']
+ subp_stdout.readline.side_effect = [cmd_output.encode()]
dovetail_utils.exec_cmd(
cmd, logger=logger, exit_on_error=True, info=False,
@@ -1286,7 +1286,6 @@ class DovetailUtilsTesting(unittest.TestCase):
log_calls = [
call(verbose, logger, "Executing command: '%s'" % cmd, 'debug'),
call(verbose, logger, cmd_output, 'debug', True),
- call(verbose, logger, '', 'debug', True),
call(verbose, logger, "The command '%s' failed." % cmd, 'error')]
mock_log.assert_has_calls(log_calls)
mock_open.assert_called_once_with(cmd, shell=True, stdout=mock_pipe,