GitRepository/git_command: strip stderr output in case of error
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Wed, 11 Dec 2013 13:50:13 +0000 (15:50 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Mar 2015 08:07:45 +0000 (10:07 +0200)
In order to get rid of extra line feeds in exception message.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py
tests/component/rpm/test_pq_rpm.py

index 91c7dc258e7f0ecfce65db1237dd311069143d1c..b7c29356888feaa82c264822695229917cfcd099 100644 (file)
@@ -295,7 +295,8 @@ class GitRepository(object):
         except Exception as excobj:
             raise GitRepositoryError("Error running git %s: %s" % (command, excobj))
         if ret:
-            raise GitRepositoryError("Error running git %s: %s" % (command, stderr))
+            raise GitRepositoryError("Error running git %s: %s" %
+                                        (command, stderr.strip()))
 
 
     def _cmd_has_feature(self, command, feature):
index 3ed9ad1c417ff246a0a15a0adefe534540ff9fbe..244f11bd186fdd72e052d9a1dfc7bdb6c5ee09c3 100644 (file)
@@ -372,7 +372,7 @@ class TestPqRpm(RpmRepoTestBase):
         with open('my2.patch', 'w') as patch_file:
             patch_file.write('-this-does\n+not-apply\n')
         eq_(mock_pq(['import']), 1)
-        self._check_log(-2, "("
+        self._check_log(-1, "("
                              "Aborting|"
                              "Please, commit your changes or stash them|"
                              "gbp:error: Import failed.* You have local changes"