Some unit tests for hooks.py

This commit is contained in:
Peter Eckersley
2016-03-30 13:15:54 -07:00
parent ffefac466a
commit c11af67f2a
+3 -2
View File
@@ -77,13 +77,14 @@ def _run_hook(shell_cmd):
if err:
logger.error('Error output from %s:\n%s', _prog(shell_cmd), err)
def _is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
def _which(program):
"""Test if program is in the path."""
# Borrowed from:
# https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
# XXX May need more porting to handle .exe extensions on Windows
def _is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, _fname = os.path.split(program)
if fpath: