| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,4 +6,3 @@ pytest | |||
| 6 | 6 | types-PyYAML==6.0.1 | |
| 7 | 7 | types-requests==2.26.0 | |
| 8 | 8 | types-setuptools==57.4.3 | |
| 9 | - types-toml==0.10.1 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,6 @@ | |||
| 8 | 8 | from typing import Tuple, Type | |
| 9 | 9 | ||
| 10 | 10 | import _pytest | |
| 11 | - import toml | ||
| 12 | 11 | ||
| 13 | 12 | import gitlab.mixins | |
| 14 | 13 | import gitlab.v4.objects | |
@@ -18,20 +17,8 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None: | |||
| 18 | 17 | """Find all of the classes in gitlab.v4.objects and pass them to our test | |
| 19 | 18 | function""" | |
| 20 | 19 | ||
| 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): | ||
| 35 | 22 | if not inspect.ismodule(module_value): | |
| 36 | 23 | # We only care about the modules | |
| 37 | 24 | continue | |
@@ -41,17 +28,16 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None: | |||
| 41 | 28 | continue | |
| 42 | 29 | ||
| 43 | 30 | module_name = class_value.__module__ | |
| 44 | - # Ignore modules that mypy is ignoring | ||
| 45 | - if module_name in excluded_modules: | ||
| 46 | - continue | ||
| 47 | - | ||
| 48 | 31 | # Ignore imported classes from gitlab.base | |
| 49 | 32 | if module_name == "gitlab.base": | |
| 50 | 33 | continue | |
| 51 | 34 | ||
| 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)) | ||
| 53 | 39 | ||
| 54 | - metafunc.parametrize("class_info", class_info_list) | ||
| 40 | + metafunc.parametrize("class_info", class_info_set) | ||
| 55 | 41 | ||
| 56 | 42 | ||
| 57 | 43 | class TestTypeHints: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments