Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b78c10

Browse files
authored
Merge pull request#1693 from python-gitlab/jlvillay/mypy_test_meta
chore: enable mypy for tests/meta/*
2 parents21228cd +ba7707f commit9b78c10

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
importinspect
88
fromtypingimportTuple,Type
99

10+
import_pytest
1011
importtoml
1112

1213
importgitlab.mixins
1314
importgitlab.v4.objects
1415

1516

16-
defpytest_generate_tests(metafunc):
17+
defpytest_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
classTestTypeHints:
57-
deftest_check_get_function_type_hints(self,class_info:Tuple[str,Type]):
58+
deftest_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
importgitlab.v4.objects
5050

5151

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

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

6262
withpytest.raises(TypeError)asexc_info:
6363
# Wrong ordering here
64-
classWrongv4Object(RESTObject,Mixin):
64+
classWrongv4Object(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-
deftest_mros():
79+
deftest_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)

[8]ページ先頭

©2009-2025 Movatter.jp