Example #1
0
 def testRaisesWhenBadVersionNumber(self):
   self.subprocess_mock.return_value = 'git version x'
   with self.assertRaisesRegex(
       git.InvalidGitException,
       ('The git version string must contain a version number')):
     git.CheckGitVersion(self.min_version)
Example #2
0
 def testRaisesWhenNotFound(self):
   self.subprocess_mock.side_effect = OSError(errno.ENOENT, 'not found')
   with self.assertRaisesRegex(
       git.NoGitException,
       ('Cannot find git. Please install git and try again.')):
     git.CheckGitVersion(self.min_version)
Example #3
0
 def testRaisesWhenBadOutput(self):
   self.subprocess_mock.return_value = 'sit versi'
   with self.assertRaisesRegex(
       git.InvalidGitException,
       ('The git version string must start with git version')):
     git.CheckGitVersion(self.min_version)
Example #4
0
 def testRaisesWhenNoVersion(self):
   self.subprocess_mock.return_value = ''
   with self.assertRaisesRegex(git.InvalidGitException,
                               ('The git version string is empty.')):
     git.CheckGitVersion(self.min_version)
Example #5
0
 def testRaisesWhenMinVersionIsSmaller(self):
   self.subprocess_mock.return_value = 'git version 1.8.9'
   with self.assertRaisesRegex(
       git.GitVersionException,
       (r'Your git version .*\..* is older than the minimum version (\d+)\.')):
     git.CheckGitVersion(self.min_version)
Example #6
0
 def testNoCheckMinVersion(self):
   self.subprocess_mock.return_value = 'git version 0.0.0'
   self.assertEqual(True, git.CheckGitVersion())
Example #7
0
 def testMatchesMinVersionWhenEqual(self):
   self.subprocess_mock.return_value = 'git version 2.0.1'
   self.assertEqual(True, git.CheckGitVersion(self.min_version))