Add mypy invocation to unit test
This way it's easy to run both the tests and mypy.
This commit is contained in:
parent
cc06a191a1
commit
4c3d288be9
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
/*.egg-info/
|
/*.egg-info/
|
||||||
/.cache
|
/.cache
|
||||||
/.mypy_cache/
|
.mypy_cache/
|
||||||
/.pytest_cache
|
/.pytest_cache
|
||||||
.coverage
|
.coverage
|
||||||
/dist/
|
/dist/
|
||||||
|
|||||||
24
tests/test_mypy.py
Normal file
24
tests/test_mypy.py
Normal 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))
|
||||||
Loading…
x
Reference in New Issue
Block a user