Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
b7fd746d
Commit
b7fd746d
authored
Aug 01, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print test dependency versions to help with test failure debugging.
parent
9f03226c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
runtests.py
runtests.py
+24
-2
No files found.
runtests.py
View file @
b7fd746d
...
@@ -1843,12 +1843,34 @@ class MissingDependencyExcluder(object):
...
@@ -1843,12 +1843,34 @@ class MissingDependencyExcluder(object):
def __init__(self, deps):
def __init__(self, deps):
# deps: { matcher func : module name }
# deps: { matcher func : module name }
self.exclude_matchers = []
self.exclude_matchers = []
for matcher, mod in deps.items():
for matcher, mod
ule_name
in deps.items():
try:
try:
__import__(mod
)
module = __import__(module_name
)
except ImportError:
except ImportError:
self.exclude_matchers.append(string_selector(matcher))
self.exclude_matchers.append(string_selector(matcher))
print("Test dependency not found: '%s'" % module_name)
else:
version = self.find_dep_version(module_name, module)
print("Test dependency found: '%s' version %s" % (module_name, version))
self.tests_missing_deps = []
self.tests_missing_deps = []
def find_dep_version(self, name, module):
try:
version = module.__version__
except AttributeError:
stdlib_dir = os.path.dirname(shutil.__file__) + os.sep
module_path = getattr(module, '__file__', stdlib_dir) # no __file__? => builtin stdlib module
if module_path.startswith(stdlib_dir):
# stdlib module
version = sys.version.partition(' ')[0]
elif '.' in name:
# incrementally look for a parent package with version
name = name.rpartition('.')[0]
return self.find_dep_version(name, __import__(name))
else:
version = '?.?'
return version
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, tags):
if matcher(testname, tags):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment