diff options
author | Arnon Yaari <arnony@infinidat.com> | 2015-03-18 23:53:30 +0200 |
---|---|---|
committer | Arnon Yaari <arnony@infinidat.com> | 2015-03-18 23:53:30 +0200 |
commit | 72f896e849acc59affe85b48f3461f45838fa739 (patch) | |
tree | c7bbb35f6ce7db301d99e5764ef8be3bc860eae8 /nose | |
parent | ae14c6ec9327465087a19bc3006a26acc690d3da (diff) | |
download | nose-72f896e849acc59affe85b48f3461f45838fa739.tar.gz |
Fix #131 - use os.stat to check if file is executable
Diffstat (limited to 'nose')
-rw-r--r-- | nose/selector.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nose/selector.py b/nose/selector.py index c4a006a..dd67f52 100644 --- a/nose/selector.py +++ b/nose/selector.py @@ -8,6 +8,7 @@ thinks may be a test. """ import logging import os +import stat import unittest from nose.config import Config from nose.util import split_test_name, src, getfilename, getpackage, ispackage @@ -120,7 +121,14 @@ class Selector(object): log.debug('%s matches ignoreFiles pattern; skipped', base) return False - if not self.config.includeExe and os.access(file, os.X_OK): + + def is_executable(file): + if not os.path.exists(file): + return False + st = os.stat(file) + return bool(st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)) + + if not self.config.includeExe and is_executable(file): log.info('%s is executable; skipped', file) return False dummy, ext = op_splitext(base) |