diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-12-01 12:02:50 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-12-01 13:28:10 +0300 |
commit | 0e578a4c44d4abd539d9838347b9ebafaca41dfb (patch) | |
tree | a0c1969c37f818c830ebeff9c077eacf30be6ef8 /contrib/python/rsa/py3/tests/test_mypy.py | |
parent | 84f2d3d4cc985e63217cff149bd2e6d67ae6fe22 (diff) | |
download | ydb-0e578a4c44d4abd539d9838347b9ebafaca41dfb.tar.gz |
Change "ya.make"
Diffstat (limited to 'contrib/python/rsa/py3/tests/test_mypy.py')
-rw-r--r-- | contrib/python/rsa/py3/tests/test_mypy.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/python/rsa/py3/tests/test_mypy.py b/contrib/python/rsa/py3/tests/test_mypy.py new file mode 100644 index 0000000000..8cc0d59650 --- /dev/null +++ b/contrib/python/rsa/py3/tests/test_mypy.py @@ -0,0 +1,31 @@ +import pathlib +import sys +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", + f"--python-version={sys.version_info.major}.{sys.version_info.minor}", + ] + [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)) |