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

Commit9c8c804

Browse files
test: add a meta test to make sure that v4/objects/ files are imported
Add a test to make sure that all of the `gitlab/v4/objects/` files areimported in `gitlab/v4/objects/__init__.py`
1 parent8dfed0c commit9c8c804

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Ensure objects defined in gitlab.v4.objects are imported in
3+
`gitlab/v4/objects/__init__.py`
4+
5+
"""
6+
importpkgutil
7+
fromtypingimportSet
8+
9+
importgitlab.v4.objects
10+
11+
12+
deftest_verify_v4_objects_imported()->None:
13+
assertlen(gitlab.v4.objects.__path__)==1
14+
15+
init_files:Set[str]=set()
16+
withopen(gitlab.v4.objects.__file__,"r")asin_file:
17+
forlineinin_file.readlines():
18+
ifline.startswith("from ."):
19+
init_files.add(line.rstrip())
20+
21+
object_files=set()
22+
formoduleinpkgutil.iter_modules(gitlab.v4.objects.__path__):
23+
object_files.add(f"from .{module.name} import *")
24+
25+
missing_in_init=object_files-init_files
26+
error_message= (
27+
f"\nThe file{gitlab.v4.objects.__file__!r} is missing the following imports:"
28+
)
29+
formissinginsorted(missing_in_init):
30+
error_message+=f"\n{missing}"
31+
32+
assertnotmissing_in_init,error_message

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp