Merge "Fix TypeError when reporting old git version"
This commit is contained in:
@@ -255,9 +255,9 @@ def get_git_version():
|
||||
printwrap("Could not determine git version!")
|
||||
sys.exit(1)
|
||||
if LOCAL_GIT_VERSION < MINIMUM_GIT_VERSION:
|
||||
printwrap("Local git version %s < required git version %s" %
|
||||
printwrap("Local git version %s < required git version %s" % (
|
||||
'.'.join(map(str, LOCAL_GIT_VERSION)),
|
||||
'.'.join(map(str, MINIMUM_GIT_VERSION)))
|
||||
'.'.join(map(str, MINIMUM_GIT_VERSION))))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
@@ -469,3 +469,16 @@ class RepoUrlParsingTest(testtools.TestCase):
|
||||
r'ssh://someone%40example.org@review.opendev.org:29418/x/y'),
|
||||
('review.opendev.org', r'someone%40example.org', '29418',
|
||||
'x/y'))
|
||||
|
||||
|
||||
@mock.patch('git_review.cmd.run_command')
|
||||
class GitVersionTest(testtools.TestCase):
|
||||
def test_version_too_low(self, mock_run_command):
|
||||
# From an old CentOS 7 box
|
||||
mock_run_command.return_value = 'git version 1.8.3.1'
|
||||
self.assertRaises(SystemExit, cmd.get_git_version)
|
||||
|
||||
def test_version_good(self, mock_run_command):
|
||||
mock_run_command.return_value = 'git version 2.43.0'
|
||||
self.assertIsNone(cmd.get_git_version())
|
||||
self.assertEqual(cmd.LOCAL_GIT_VERSION, (2, 43, 0))
|
||||
|
Reference in New Issue
Block a user