This repository has been archived on 2023-02-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
flamenco-worker/tests/test_mypy.py
2021-07-09 14:26:50 +02:00

29 lines
785 B
Python

import pathlib
import unittest
import mypy.api
test_modules = ["flamenco_worker", "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 messages[0].startswith("Success:"):
self.fail("\n".join(["Mypy errors:"] + messages))