summaryrefslogtreecommitdiff
path: root/tests/test_mypy.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_mypy.py')
-rw-r--r--tests/test_mypy.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_mypy.py b/tests/test_mypy.py
new file mode 100644
index 0000000..c2a9745
--- /dev/null
+++ b/tests/test_mypy.py
@@ -0,0 +1,27 @@
+import pathlib
+import unittest
+
+import mypy.api
+
+test_modules = ['rsa', 'tests']
+
+
+class MypyRunnerTest(unittest.TestCase):
+ def test_run_mypy(self):
+ proj_root = pathlib.Path(__file__).parent.parent
+ args = ['--incremental', '--ignore-missing-imports'] + [str(proj_root / dirname) for dirname
+ in test_modules]
+
+ result = mypy.api.run(args)
+
+ stdout, stderr, status = result
+
+ messages = []
+ if stderr:
+ messages.append(stderr)
+ if stdout:
+ messages.append(stdout)
+ if status:
+ messages.append('Mypy failed with status %d' % status)
+ if messages:
+ self.fail('\n'.join(['Mypy errors:'] + messages))