diff --git a/requirements-test.txt b/requirements-test.txt index 5a230724e7faf82183e19fccef467a23e45b00bb..1e70d1639ffbb292a0a5b219e6b7b8d5307f6a5b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,9 @@ -r requirements.txt mock==4.0.3 +types-mock==4.0.3 + pytest==6.2.2 pylint==2.7.1 coverage==5.5 +mypy==0.931 diff --git a/tests/test_lint.py b/tests/test_lint.py index 712c4c3c3a771130adc5a882fcb28be683a7bba4..2f0d9bf1a9cf70a00f54e39eeb27925d1859ab19 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -1,16 +1,34 @@ from unittest import TestCase #pylint: disable=missing-class-docstring,missing-function-docstring import pathlib -from pylint import epylint - +from pylint import epylint # type: ignored class CodeQualityCase(TestCase): def setUp(self): self.vcsroot = pathlib.Path(__file__).parent.parent.absolute() self.rcfile = self.vcsroot.joinpath('.pylintrc') + self.module_source_dir = "mattermost_matchmaker" + self.test_source_dir = "tests" + def test_source_quality(self): - self.assertEqual(0, epylint.lint("mattermost_matchmaker", ["--fail-under=9.5", f"--rcfile={self.rcfile}"])) + self.assertEqual(0, epylint.lint(self.module_source_dir, ["--fail-under=9.5", f"--rcfile={self.rcfile}"])) def test_test_quality(self): - self.assertEqual(0, epylint.lint("tests", ["--fail-under=9.5", f"--rcfile={self.rcfile}"])) + self.assertEqual(0, epylint.lint(self.test_source_dir, ["--fail-under=9.5", f"--rcfile={self.rcfile}"])) + + def test_source_types(self): + #pylint: disable=import-outside-toplevel,no-name-in-module + from mypy.build import build as mypy_build + from mypy.options import Options as Mypy_Options + from mypy.find_sources import create_source_list as mypy_source_list + + options = Mypy_Options() + options.config_file=str(self.vcsroot.joinpath("mypy.ini")) + + res = mypy_build( + sources=mypy_source_list([str(self.vcsroot.joinpath(self.module_source_dir))], options=options), + options=options, + ) + + self.assertCountEqual(res.errors, [])