Commit 32ea1429 authored by Robert Bradshaw's avatar Robert Bradshaw

Use tags for test deps.

parent 6a6eeb49
...@@ -68,25 +68,23 @@ if sys.platform == 'win32': ...@@ -68,25 +68,23 @@ if sys.platform == 'win32':
except ValueError: pass except ValueError: pass
distutils_distro.parse_config_files(cfgfiles) distutils_distro.parse_config_files(cfgfiles)
# Lists external modules, and a matcher matching tests
# which should be excluded if the module is not present.
# TODO: use tags for these
EXT_DEP_MODULES = { EXT_DEP_MODULES = {
'numpy' : re.compile('.*\.numpy_.*').match, 'numpy' : 'tag:numpy',
'pstats' : re.compile('.*\.pstats_.*').match, 'pstats' : 'tag:pstats',
'posix' : re.compile('.*\.posix_.*').match, 'posix' : 'tag:posix',
} }
def get_numpy_include_dirs(): def get_numpy_include_dirs():
import numpy import numpy
return [numpy.get_include()] return [numpy.get_include()]
# TODO: use tags
EXT_DEP_INCLUDES = [ EXT_DEP_INCLUDES = [
# test name matcher , callable returning list # test name matcher , callable returning list
(re.compile('numpy_.*').match, get_numpy_include_dirs), (re.compile('numpy_.*').match, get_numpy_include_dirs),
] ]
# TODO: use tags
VER_DEP_MODULES = { VER_DEP_MODULES = {
# tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e. # tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e.
# (2,4) : (operator.lt, ...) excludes ... when PyVer < 2.4.x # (2,4) : (operator.lt, ...) excludes ... when PyVer < 2.4.x
...@@ -971,11 +969,11 @@ class MissingDependencyExcluder: ...@@ -971,11 +969,11 @@ class MissingDependencyExcluder:
try: try:
__import__(mod) __import__(mod)
except ImportError: except ImportError:
self.exclude_matchers.append(matcher) self.exclude_matchers.append(string_selector(matcher))
self.tests_missing_deps = [] self.tests_missing_deps = []
def __call__(self, testname, tags=None): def __call__(self, testname, tags=None):
for matcher in self.exclude_matchers: for matcher in self.exclude_matchers:
if matcher(testname): if matcher(testname, tags):
self.tests_missing_deps.append(testname) self.tests_missing_deps.append(testname)
return True return True
return False return False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment