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

Commita2e838f

Browse files
chore: remove duplicate/no-op tests from meta/test_ensure_type_hints
Before we were generating 725 tests for themeta/test_ensure_type_hints.py tests. Which isn't a huge concern asit was fairly fast. But when we had a failure we would usually get twofailures for each problem as the same test was being run multipletimes.Changed it so that: 1. Don't add tests that are not for *Manager classes 2. Use a set so that we don't have duplicate tests.After doing that our generated test count inmeta/test_ensure_type_hints.py went from 725 to 178 tests.To determine the test count the following command was run: $ tox -e py39 -- -k test_ensure_type_hints
1 parent7ba5995 commita2e838f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎tests/meta/test_ensure_type_hints.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None:
3030
ifmodule.startswith("gitlab.v4.objects"):
3131
excluded_modules.add(module)
3232

33-
class_info_list=[]
33+
class_info_set=set()
3434
formodule_name,module_valueininspect.getmembers(gitlab.v4.objects):
3535
ifnotinspect.ismodule(module_value):
3636
# We only care about the modules
@@ -49,9 +49,10 @@ def pytest_generate_tests(metafunc: _pytest.python.Metafunc) -> None:
4949
ifmodule_name=="gitlab.base":
5050
continue
5151

52-
class_info_list.append((class_name,class_value))
53-
54-
metafunc.parametrize("class_info",class_info_list)
52+
ifnotclass_name.endswith("Manager"):
53+
continue
54+
class_info_set.add((class_name,class_value))
55+
metafunc.parametrize("class_info",class_info_set)
5556

5657

5758
classTestTypeHints:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp