diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-11-23 00:10:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 00:10:00 +0100 |
commit | 9b78c101309d201a4ff2d1ca7974a7c57cb1ad62 (patch) | |
tree | 56048bc44438415131f68bdd431c37a6e3f85883 | |
parent | 21228cd14fe18897485728a01c3d7103bff7f822 (diff) | |
parent | ba7707f6161463260710bd2b109b172fd63472a1 (diff) | |
download | gitlab-9b78c101309d201a4ff2d1ca7974a7c57cb1ad62.tar.gz |
Merge pull request #1693 from python-gitlab/jlvillay/mypy_test_meta
chore: enable mypy for tests/meta/*
-rw-r--r-- | pyproject.toml | 1 | ||||
-rw-r--r-- | requirements-lint.txt | 2 | ||||
-rw-r--r-- | tests/meta/test_ensure_type_hints.py | 5 | ||||
-rw-r--r-- | tests/meta/test_mro.py | 6 |
4 files changed, 8 insertions, 6 deletions
diff --git a/pyproject.toml b/pyproject.toml index 12df1df..75dd28b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,6 @@ module = [ "gitlab.v4.objects.sidekiq", "tests.functional.*", "tests.functional.api.*", - "tests.meta.*", "tests.unit.*", "tests.smoke.*" ] diff --git a/requirements-lint.txt b/requirements-lint.txt index 08ba6dc..c0048ea 100644 --- a/requirements-lint.txt +++ b/requirements-lint.txt @@ -2,6 +2,8 @@ black==20.8b1 flake8==4.0.1 isort==5.10.1 mypy==0.910 +pytest types-PyYAML==6.0.1 types-requests==2.26.0 types-setuptools==57.4.2 +types-toml==0.10.1 diff --git a/tests/meta/test_ensure_type_hints.py b/tests/meta/test_ensure_type_hints.py index f647b45..7a351ec 100644 --- a/tests/meta/test_ensure_type_hints.py +++ b/tests/meta/test_ensure_type_hints.py @@ -7,13 +7,14 @@ Original notes by John L. Villalovos import inspect from typing import Tuple, Type +import _pytest import toml import gitlab.mixins import gitlab.v4.objects -def pytest_generate_tests(metafunc): +def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None: """Find all of the classes in gitlab.v4.objects and pass them to our test function""" @@ -54,7 +55,7 @@ def pytest_generate_tests(metafunc): class TestTypeHints: - def test_check_get_function_type_hints(self, class_info: Tuple[str, Type]): + def test_check_get_function_type_hints(self, class_info: Tuple[str, Type]) -> None: """Ensure classes derived from GetMixin have defined a 'get()' method with correct type-hints. """ diff --git a/tests/meta/test_mro.py b/tests/meta/test_mro.py index 8f67b77..8558a8b 100644 --- a/tests/meta/test_mro.py +++ b/tests/meta/test_mro.py @@ -49,7 +49,7 @@ import pytest import gitlab.v4.objects -def test_show_issue(): +def test_show_issue() -> None: """Test case to demonstrate the TypeError that occurs""" class RESTObject(object): @@ -61,7 +61,7 @@ def test_show_issue(): with pytest.raises(TypeError) as exc_info: # Wrong ordering here - class Wrongv4Object(RESTObject, Mixin): + class Wrongv4Object(RESTObject, Mixin): # type: ignore ... # The error message in the exception should be: @@ -76,7 +76,7 @@ def test_show_issue(): ... -def test_mros(): +def test_mros() -> None: """Ensure objects defined in gitlab.v4.objects have REST* as last item in class definition. |