Files
rk35xx-android14/external/python/rsa/tests/test_mypy.py
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

28 lines
830 B
Python

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 and not all('Success' in message for message in messages):
self.fail('\n'.join(['Mypy errors:'] + messages))