def test_check_git_version_no_git(self): # Check that a warning is raised if git isn't installed. with mock.patch.object(git, 'git_version') as gitv: gitv.side_effect = exceptions.SimplGitCommandError( 127, 'git version', output="OSError(2, 'No such file or directory')") with warnings.catch_warnings(record=True) as wrn: git.check_git_version() [warning] = wrn self.assertEqual("Git does not appear to be installed!", warning.message.message)
def test_check_git_version_old(self): # Check that a warning is raised if the installed git version is older # than recommended. with mock.patch.object(git, 'git_version') as gitv: gitv.return_value = 'git version 1.8.5.6' with warnings.catch_warnings(record=True) as caught: git.check_git_version() self.assertEqual(len(caught), 1) warning = caught[-1] self.assertEqual( "Git version 1.8.5.6 found. 1.9 or greater " "is recommended for simpl/git.py", str(warning.message))
def test_check_git_version_old(self): # Check that a warning is raised if the installed git version is older # than recommended. with mock.patch.object(git, 'git_version') as gitv: gitv.return_value = 'git version 1.8.5.6' with warnings.catch_warnings(record=True) as wrn: git.check_git_version() [warning] = wrn self.assertEqual( "Git version 1.8.5.6 found. 1.9 or greater " "is recommended for simpl/git.py", warning.message.message)
def test_check_git_version_no_git(self): # Check that a warning is raised if git isn't installed. with mock.patch.object(git, 'git_version') as gitv: gitv.side_effect = exceptions.SimplGitCommandError( 127, 'git version', output="OSError(2, 'No such file or directory')") with warnings.catch_warnings(record=True) as caught: git.check_git_version() self.assertEqual(len(caught), 1) warning = caught[-1] self.assertEqual("Git does not appear to be installed!", str(warning.message))