Skip to content

Commit 9b78c10

Browse files
authored
Merge pull request #1693 from python-gitlab/jlvillay/mypy_test_meta
chore: enable mypy for tests/meta/*
2 parents 21228cd + ba7707f commit 9b78c10

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module = [
2525
"gitlab.v4.objects.sidekiq",
2626
"tests.functional.*",
2727
"tests.functional.api.*",
28-
"tests.meta.*",
2928
"tests.unit.*",
3029
"tests.smoke.*"
3130
]

requirements-lint.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ black==20.8b1
22
flake8==4.0.1
33
isort==5.10.1
44
mypy==0.910
5+
pytest
56
types-PyYAML==6.0.1
67
types-requests==2.26.0
78
types-setuptools==57.4.2
9+
types-toml==0.10.1

tests/meta/test_ensure_type_hints.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
import inspect
88
from typing import Tuple, Type
99

10+
import _pytest
1011
import toml
1112

1213
import gitlab.mixins
1314
import gitlab.v4.objects
1415

1516

16-
def pytest_generate_tests(metafunc):
17+
def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None:
1718
"""Find all of the classes in gitlab.v4.objects and pass them to our test
1819
function"""
1920

@@ -54,7 +55,7 @@ def pytest_generate_tests(metafunc):
5455

5556

5657
class TestTypeHints:
57-
def test_check_get_function_type_hints(self, class_info: Tuple[str, Type]):
58+
def test_check_get_function_type_hints(self, class_info: Tuple[str, Type]) -> None:
5859
"""Ensure classes derived from GetMixin have defined a 'get()' method with
5960
correct type-hints.
6061
"""

tests/meta/test_mro.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Wrongv4Object(RESTObject, Mixin):
4949
import gitlab.v4.objects
5050

5151

52-
def test_show_issue():
52+
def test_show_issue() -> None:
5353
"""Test case to demonstrate the TypeError that occurs"""
5454

5555
class RESTObject(object):
@@ -61,7 +61,7 @@ class Mixin(RESTObject):
6161

6262
with pytest.raises(TypeError) as exc_info:
6363
# Wrong ordering here
64-
class Wrongv4Object(RESTObject, Mixin):
64+
class Wrongv4Object(RESTObject, Mixin): # type: ignore
6565
...
6666

6767
# The error message in the exception should be:
@@ -76,7 +76,7 @@ class Correctv4Object(Mixin, RESTObject):
7676
...
7777

7878

79-
def test_mros():
79+
def test_mros() -> None:
8080
"""Ensure objects defined in gitlab.v4.objects have REST* as last item in
8181
class definition.
8282

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy