diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-11-04 16:19:35 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-11-04 16:26:10 +0100 |
commit | ea5775a23e5223026b37100d23229b1bfc39bafa (patch) | |
tree | 3f715a64685ce1a5880a13d0706d8fea4cae8329 /tests | |
parent | ced46db062f8e38c0eed7d1feb6e6e8b0d6435f9 (diff) |
commands: allow to fall back to error reason if stderr is empty
Use this in PristineTar and SrcRpmFile to give better error messages if
the command doesn't even get to print to stderr (i.e. missing on disk).
Closes: #842592
Diffstat (limited to 'tests')
-rw-r--r-- | tests/21_test_command_wrappers.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/21_test_command_wrappers.py b/tests/21_test_command_wrappers.py index 4dfbb48e..fd442c82 100644 --- a/tests/21_test_command_wrappers.py +++ b/tests/21_test_command_wrappers.py @@ -63,6 +63,21 @@ class TestCommandWrapperFailures(unittest.TestCase, GbpLogTester): self.assertEqual(self.false.stderr, '') self.assertEqual(self.false.stdout, 'we have a problem') + def test_log_use_err_or_reason_for_error_messge_reason(self): + self.false.run_error = "AFAIK {stderr_or_reason}" + with self.assertRaises(CommandExecFailed): + self.false.__call__() + self.log_tester._check_log(0, "gbp:error: AFAIK execution failed: .Errno 2. No such file or directory") + self.assertEqual(self.false.retcode, 1) + + @patch_popen(stderr='we have a problem', returncode=1) + def test_log_use_err_or_reason_for_error_messge_error(self, create_mock): + self.false.run_error = "Erpel {stderr_or_reason}" + with self.assertRaises(CommandExecFailed): + self.false.__call__() + self.log_tester._check_log(0, "gbp:error: Erpel we have a problem") + self.assertEqual(self.false.retcode, 1) + @patch_popen(returncode=0) def test_no_log_on_success(self, create_mock): self.false.__call__() |