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
Xavier Thompson
cython
Commits
3c7e61ac
Commit
3c7e61ac
authored
Oct 29, 2017
by
Julian Gethmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mypy test capability to PureDoctestTestCase
* run mypy against test modules tagged with `mypy`
parent
9255de4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
runtests.py
runtests.py
+21
-2
No files found.
runtests.py
View file @
3c7e61ac
...
...
@@ -612,7 +612,7 @@ class TestBuilder(object):
if pyver
]
if not min_py_ver or any(sys.version_info >= min_ver for min_ver in min_py_ver):
suite.addTest(PureDoctestTestCase(module, os.path.join(path, filename)))
suite.addTest(PureDoctestTestCase(module, os.path.join(path, filename)
, tags
))
return suite
...
...
@@ -1202,7 +1202,8 @@ def run_forked_test(result, run_func, test_name, fork=True):
except: pass
class PureDoctestTestCase(unittest.TestCase):
def __init__(self, module_name, module_path):
def __init__(self, module_name, module_path, tags):
self.tags = tags
self.module_name = module_name
self.module_path = module_path
unittest.TestCase.__init__(self, 'run')
...
...
@@ -1235,6 +1236,24 @@ class PureDoctestTestCase(unittest.TestCase):
except Exception:
pass
try:
from mypy import api as mypy_api
nomypy = False
except ImportError:
nomypy = True
if 'mypy' in self.tags['tag'] and not nomypy:
mypy_result = mypy_api.run((
self.module_path,
'--ignore-missing-imports',
'--follow-imports', 'skip',
))
if mypy_result[2]:
import pdb; pdb.set_trace()
self.fail(mypy_result[0])
is_private_field = re.compile('^_[^_]').match
class _FakeClass(object):
...
...
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