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

test: add a meta test to make sure that v4/objects/ files are imported#1848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intomainfromjlvillal/objects_imported
Jan 22, 2022
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletionstests/meta/test_v4_objects_imported.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
"""
Ensure objects defined in gitlab.v4.objects are imported in
`gitlab/v4/objects/__init__.py`

"""
import pkgutil
from typing import Set

import gitlab.v4.objects


def test_verify_v4_objects_imported() -> None:
assert len(gitlab.v4.objects.__path__) == 1

init_files: Set[str] = set()
with open(gitlab.v4.objects.__file__, "r") as in_file:
for line in in_file.readlines():
if line.startswith("from ."):
init_files.add(line.rstrip())

object_files = set()
for module in pkgutil.iter_modules(gitlab.v4.objects.__path__):
object_files.add(f"from .{module.name} import *")

missing_in_init = object_files - init_files
error_message = (
f"\nThe file {gitlab.v4.objects.__file__!r} is missing the following imports:"
)
for missing in sorted(missing_in_init):
error_message += f"\n {missing}"

assert not missing_in_init, error_message

[8]ページ先頭

©2009-2025 Movatter.jp