Fix tests for GitPython>0.3.2.RC1
Catches the GitCommandError exception when a ref does not exist. Change-Id: I9fe2e95d64eaf06537723957c6e7eaaf9282ccab
This commit is contained in:
parent
b6bfbcc37b
commit
8225f52a6f
|
@ -5,7 +5,7 @@ PyYAML>=3.1.0
|
|||
Paste
|
||||
WebOb>=1.2.3,<1.3
|
||||
paramiko>=1.8.0
|
||||
GitPython==0.3.2.RC1
|
||||
GitPython>=0.3.2.1
|
||||
lockfile>=0.8
|
||||
ordereddict
|
||||
python-daemon
|
||||
|
|
|
@ -40,6 +40,7 @@ import fixtures
|
|||
import six.moves.urllib.parse as urlparse
|
||||
import statsd
|
||||
import testtools
|
||||
from git import GitCommandError
|
||||
|
||||
import zuul.scheduler
|
||||
import zuul.webapp
|
||||
|
@ -1031,9 +1032,12 @@ class ZuulTestCase(testtools.TestCase):
|
|||
def ref_has_change(self, ref, change):
|
||||
path = os.path.join(self.git_root, change.project)
|
||||
repo = git.Repo(path)
|
||||
for commit in repo.iter_commits(ref):
|
||||
if commit.message.strip() == ('%s-1' % change.subject):
|
||||
return True
|
||||
try:
|
||||
for commit in repo.iter_commits(ref):
|
||||
if commit.message.strip() == ('%s-1' % change.subject):
|
||||
return True
|
||||
except GitCommandError:
|
||||
pass
|
||||
return False
|
||||
|
||||
def job_has_changes(self, *args):
|
||||
|
|
Loading…
Reference in New Issue