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

Commit7c46e4d

Browse files
committed
Merge branch 'issue-2264-add-application-statistics' ofhttps://github.com/Shreya-7/python-gitlab into issue-2264-add-application-statistics
2 parents153e53b +08b9502 commit7c46e4d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

‎tests/functional/api/test_statistics.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
GitLab API: https://docs.gitlab.com/ee/api/statistics.html
33
"""
44

5+
fromtests.functional.conftestimportreset_gitlab
6+
57

68
deftest_get_statistics(gl):
7-
gl.projects.create({"name":"projecttruffles"})
9+
10+
# delete resources created from other functional tests to reset application statistics
11+
reset_gitlab(gl)
12+
813
gl.users.create(
914
{
1015
"email":"veryuniqueemail@test.com",

‎tests/functional/conftest.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,17 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None:
9494
helpers.safe_delete(deploy_token)
9595
logging.info(f"Deleting project:{project.path_with_namespace!r}")
9696
helpers.safe_delete(project)
97+
9798
forgroupingl.groups.list():
99+
100+
# skip deletion of a descendant group to prevent scenarios where parent group gets deleted leaving a dangling descendant whose deletion will throw 404s.
101+
# descendant groups cannot contain the `/` special character: https://docs.gitlab.com/ee/user/reserved_names.html#limitations-on-project-and-group-names
102+
if"/"ingroup.full_path:
103+
logging.info(
104+
f"Skipping deletion of{group.full_path} as it is a descendant group and will be removed when the parent group is deleted"
105+
)
106+
continue
107+
98108
fordeploy_tokeningroup.deploytokens.list():
99109
logging.info(
100110
f"Deleting deploy token:{deploy_token.username!r} in "
@@ -110,7 +120,7 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None:
110120
logging.info(f"Deleting variable:{variable.key!r}")
111121
helpers.safe_delete(variable)
112122
foruseringl.users.list():
113-
ifuser.username!="root":
123+
ifuser.usernamenotin ["root","ghost"]:
114124
logging.info(f"Deleting user:{user.username!r}")
115125
helpers.safe_delete(user,hard_delete=True)
116126

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp