Skip to content

Commit 3225f2c

Browse files
authored
Merge pull request python-gitlab#1707 from python-gitlab/jlvillal/reduce_meta_tests
chore: remove duplicate/no-op tests from meta/test_ensure_type_hints
2 parents 7ba5995 + a2f59f4 commit 3225f2c

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

requirements-lint.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ pytest
66
types-PyYAML==6.0.1
77
types-requests==2.26.0
88
types-setuptools==57.4.3
9-
types-toml==0.10.1

tests/meta/test_ensure_type_hints.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from typing import Tuple, Type
99

1010
import _pytest
11-
import toml
1211

1312
import gitlab.mixins
1413
import gitlab.v4.objects
@@ -18,20 +17,8 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None:
1817
"""Find all of the classes in gitlab.v4.objects and pass them to our test
1918
function"""
2019

21-
# Ignore any modules that we are ignoring in our pyproject.toml
22-
excluded_modules = set()
23-
with open("pyproject.toml", "r") as in_file:
24-
pyproject = toml.load(in_file)
25-
overrides = pyproject.get("tool", {}).get("mypy", {}).get("overrides", [])
26-
for override in overrides:
27-
if not override.get("ignore_errors"):
28-
continue
29-
for module in override.get("module", []):
30-
if module.startswith("gitlab.v4.objects"):
31-
excluded_modules.add(module)
32-
33-
class_info_list = []
34-
for module_name, module_value in inspect.getmembers(gitlab.v4.objects):
20+
class_info_set = set()
21+
for _, module_value in inspect.getmembers(gitlab.v4.objects):
3522
if not inspect.ismodule(module_value):
3623
# We only care about the modules
3724
continue
@@ -41,17 +28,16 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None:
4128
continue
4229

4330
module_name = class_value.__module__
44-
# Ignore modules that mypy is ignoring
45-
if module_name in excluded_modules:
46-
continue
47-
4831
# Ignore imported classes from gitlab.base
4932
if module_name == "gitlab.base":
5033
continue
5134

52-
class_info_list.append((class_name, class_value))
35+
if not class_name.endswith("Manager"):
36+
continue
37+
38+
class_info_set.add((class_name, class_value))
5339

54-
metafunc.parametrize("class_info", class_info_list)
40+
metafunc.parametrize("class_info", class_info_set)
5541

5642

5743
class TestTypeHints:

0 commit comments

Comments
 (0)