summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnon Yaari <arnony@infinidat.com>2015-03-19 10:30:05 +0200
committerArnon Yaari <arnony@infinidat.com>2015-03-19 10:30:05 +0200
commit6f9dada1a5593b2365859bab92c7d1e468b64b7b (patch)
tree34b859ba5a320d57b075ecdda75a94dcde2a9e66
parent72f896e849acc59affe85b48f3461f45838fa739 (diff)
downloadnose-6f9dada1a5593b2365859bab92c7d1e468b64b7b.tar.gz
move is_executable to nose.util
-rw-r--r--nose/selector.py10
-rw-r--r--nose/util.py10
2 files changed, 10 insertions, 10 deletions
diff --git a/nose/selector.py b/nose/selector.py
index dd67f52..b63f7af 100644
--- a/nose/selector.py
+++ b/nose/selector.py
@@ -8,10 +8,9 @@ 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
+from nose.util import split_test_name, src, getfilename, getpackage, ispackage, is_executable
log = logging.getLogger(__name__)
@@ -121,13 +120,6 @@ class Selector(object):
log.debug('%s matches ignoreFiles pattern; skipped',
base)
return False
-
- 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
diff --git a/nose/util.py b/nose/util.py
index efab8fe..bfe1658 100644
--- a/nose/util.py
+++ b/nose/util.py
@@ -3,6 +3,7 @@
import inspect
import itertools
import logging
+import stat
import os
import re
import sys
@@ -654,7 +655,14 @@ def safe_str(val, encoding='utf-8'):
for arg in val])
return unicode(val).encode(encoding)
-
+
+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 __name__ == '__main__':
import doctest
doctest.testmod()