aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-11-09 13:27:54 +0100
committerGuido Günther <agx@sigxcpu.org>2017-11-09 13:30:03 +0100
commit4378eae4cc22ea612dc48823dfbe74b4d9f45ba9 (patch)
tree3012dda2ae5111cf60e87792854f95ba5b5318f6 /tests
parentde3de7d599f0563b4c7c565c8ec86fd409f9fcde (diff)
command_wrapper: quote error strings
so we don't accidentally try to expand values in error messages Closes: #881254
Diffstat (limited to 'tests')
-rw-r--r--tests/21_test_command_wrappers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/21_test_command_wrappers.py b/tests/21_test_command_wrappers.py
index 61aab56b..3d0ed96f 100644
--- a/tests/21_test_command_wrappers.py
+++ b/tests/21_test_command_wrappers.py
@@ -36,6 +36,17 @@ class TestCommandWrapperFailures(unittest.TestCase, GbpLogTester):
self.assertEqual(self.false.stderr, 'we have a problem')
self.assertEqual(self.false.stdout, '')
+ @patch_popen(stdout=b'', stderr=b'we have a problem', returncode=1)
+ def test_log_quote_format(self, create_mock):
+ self.false = Command('/does/{not}/matter')
+ self.false.capture_stderr = True
+ with self.assertRaises(CommandExecFailed):
+ self.false.__call__()
+ self.log_tester._check_log(0, "gbp:error: '/does/{not}/matter' failed: it exited with 1")
+ self.assertEqual(self.false.retcode, 1)
+ self.assertEqual(self.false.stderr, 'we have a problem')
+ self.assertEqual(self.false.stdout, '')
+
@patch_popen(stdout=b'we have a problem', stderr=b'', returncode=1)
def test_log_use_stdout_for_err_message(self, create_mock):
self.false.capture_stdout = True