diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-11-24 22:00:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 22:00:01 +0100 |
commit | 3225f2cfee740374ef36e5cd6796d2370d0e2344 (patch) | |
tree | 3f9a9727720d76e34e0ff78489132a3041df1110 | |
parent | 7ba5995ed472997e6bf98e8ae58107af307a5615 (diff) | |
parent | a2f59f4e3146b8871a9a1d66ee84295b44321ecb (diff) | |
download | gitlab-3225f2cfee740374ef36e5cd6796d2370d0e2344.tar.gz |
Merge pull request #1707 from python-gitlab/jlvillal/reduce_meta_tests
chore: remove duplicate/no-op tests from meta/test_ensure_type_hints
-rw-r--r-- | requirements-lint.txt | 1 | ||||
-rw-r--r-- | tests/meta/test_ensure_type_hints.py | 28 |
2 files changed, 7 insertions, 22 deletions
diff --git a/requirements-lint.txt b/requirements-lint.txt index b357114..eb42924 100644 --- a/requirements-lint.txt +++ b/requirements-lint.txt @@ -6,4 +6,3 @@ pytest types-PyYAML==6.0.1 types-requests==2.26.0 types-setuptools==57.4.3 -types-toml==0.10.1 diff --git a/tests/meta/test_ensure_type_hints.py b/tests/meta/test_ensure_type_hints.py index 7a351ec..a770afb 100644 --- a/tests/meta/test_ensure_type_hints.py +++ b/tests/meta/test_ensure_type_hints.py @@ -8,7 +8,6 @@ import inspect from typing import Tuple, Type import _pytest -import toml import gitlab.mixins import gitlab.v4.objects @@ -18,20 +17,8 @@ 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""" - # Ignore any modules that we are ignoring in our pyproject.toml - excluded_modules = set() - with open("pyproject.toml", "r") as in_file: - pyproject = toml.load(in_file) - overrides = pyproject.get("tool", {}).get("mypy", {}).get("overrides", []) - for override in overrides: - if not override.get("ignore_errors"): - continue - for module in override.get("module", []): - if module.startswith("gitlab.v4.objects"): - excluded_modules.add(module) - - class_info_list = [] - for module_name, module_value in inspect.getmembers(gitlab.v4.objects): + class_info_set = set() + for _, module_value in inspect.getmembers(gitlab.v4.objects): if not inspect.ismodule(module_value): # We only care about the modules continue @@ -41,17 +28,16 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None: continue module_name = class_value.__module__ - # Ignore modules that mypy is ignoring - if module_name in excluded_modules: - continue - # Ignore imported classes from gitlab.base if module_name == "gitlab.base": continue - class_info_list.append((class_name, class_value)) + if not class_name.endswith("Manager"): + continue + + class_info_set.add((class_name, class_value)) - metafunc.parametrize("class_info", class_info_list) + metafunc.parametrize("class_info", class_info_set) class TestTypeHints: |