Add mypy invocation to unit test

This way it's easy to run both the tests and mypy.
This commit is contained in:
Sybren A. Stüvel 2018-03-09 14:24:06 +01:00
parent cc06a191a1
commit 4c3d288be9
2 changed files with 25 additions and 1 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
__pycache__
/*.egg-info/
/.cache
/.mypy_cache/
.mypy_cache/
/.pytest_cache
.coverage
/dist/

24
tests/test_mypy.py Normal file
View File

@ -0,0 +1,24 @@
import pathlib
import unittest
import mypy.api
import blender_asset_tracer
class MypyRunnerTest(unittest.TestCase):
def test_run_mypy(self):
path = pathlib.Path(blender_asset_tracer.__file__).parent
result = mypy.api.run(['--incremental', str(path)])
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))