def test_should_return_false_when_trying_to_execute_command_fails(self): when(execution).check_call(ANY_ARGUMENTS).then_raise(OSError()) actual_result = check_if_is_executable('command', '--version', '--quiet') self.assertFalse(actual_result) verify(execution).check_call(['command', '--version', '--quiet'])
def test_should_return_false_when_command_is_not_executable(self): when(execution).check_call(ANY_ARGUMENTS).then_raise(subprocess.CalledProcessError(127, 'command')) actual_result = check_if_is_executable('command', '--version', '--quiet') self.assertFalse(actual_result) verify(execution).check_call(['command', '--version', '--quiet'])
def test_should_return_true_when_command_is_executable(self): when(execution).check_call(ANY_ARGUMENTS).then_return(None) actual_result = check_if_is_executable('command', '--version', '--quiet') self.assertTrue(actual_result) verify(execution).check_call(['command', '--version', '--quiet'])
def is_executable(self): """ Checks if svn client is executable. @return: True if "svn --version --quiet" is executable, False otherwise. """ return check_if_is_executable(self.command, '--version', '--quiet')
def is_executable(self): """ Checks if the git command line client is executable. @return: True if "git --version" is executable, False otherwise. """ return check_if_is_executable(self.command, '--version')
def is_executable(self): """ @return: True if "hg --version --quiet" is executable, False otherwise. """ return check_if_is_executable(self.command, '--version', '--quiet')