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

Commit6b8067e

Browse files
chore: use constants from gitlab.const module
Have code use constants from the gitlab.const module instead of fromthe top-level gitlab module.
1 parentc0aa0e1 commit6b8067e

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

‎gitlab/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ class AccessRequestMixin(_RestObjectBase):
618618
)
619619
@exc.on_http_error(exc.GitlabUpdateError)
620620
defapprove(
621-
self,access_level:int=gitlab.DEVELOPER_ACCESS,**kwargs:Any
621+
self,access_level:int=gitlab.const.DEVELOPER_ACCESS,**kwargs:Any
622622
)->None:
623623
"""Approve an access request.
624624

‎tests/functional/api/test_gitlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ def test_namespaces(gl):
118118

119119
deftest_notification_settings(gl):
120120
settings=gl.notificationsettings.get()
121-
settings.level=gitlab.NOTIFICATION_LEVEL_WATCH
121+
settings.level=gitlab.const.NOTIFICATION_LEVEL_WATCH
122122
settings.save()
123123

124124
settings=gl.notificationsettings.get()
125-
assertsettings.level==gitlab.NOTIFICATION_LEVEL_WATCH
125+
assertsettings.level==gitlab.const.NOTIFICATION_LEVEL_WATCH
126126

127127

128128
deftest_user_activities(gl):

‎tests/functional/api/test_snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_project_snippets(project):
3333
"title":"snip1",
3434
"file_name":"foo.py",
3535
"content":"initial content",
36-
"visibility":gitlab.VISIBILITY_PRIVATE,
36+
"visibility":gitlab.const.VISIBILITY_PRIVATE,
3737
}
3838
)
3939

‎tests/unit/test_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
importpytest
2424

25-
fromgitlabimportconfig,USER_AGENT
25+
importgitlab
26+
fromgitlabimportconfig
2627

2728
custom_user_agent="my-package/1.0.0"
2829

@@ -252,7 +253,7 @@ def test_data_from_helper(m_open, path_exists, tmp_path):
252253
@pytest.mark.parametrize(
253254
"config_string,expected_agent",
254255
[
255-
(valid_config,USER_AGENT),
256+
(valid_config,gitlab.const.USER_AGENT),
256257
(custom_user_agent_config,custom_user_agent),
257258
],
258259
)

‎tests/unit/test_gitlab.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,19 @@ def test_gitlab_token_auth(gl, callback=None):
129129

130130
deftest_gitlab_default_url():
131131
gl=gitlab.Gitlab()
132-
assertgl.url==gitlab.DEFAULT_URL
132+
assertgl.url==gitlab.const.DEFAULT_URL
133133

134134

135135
@pytest.mark.parametrize(
136136
"args, kwargs, expected_url, expected_private_token, expected_oauth_token",
137137
[
138-
([], {},gitlab.DEFAULT_URL,None,None),
139-
([None,token], {},gitlab.DEFAULT_URL,token,None),
138+
([], {},gitlab.const.DEFAULT_URL,None,None),
139+
([None,token], {},gitlab.const.DEFAULT_URL,token,None),
140140
([localhost], {},localhost,None,None),
141141
([localhost,token], {},localhost,token,None),
142142
([localhost,None,token], {},localhost,None,token),
143-
([], {"private_token":token},gitlab.DEFAULT_URL,token,None),
144-
([], {"oauth_token":token},gitlab.DEFAULT_URL,None,token),
143+
([], {"private_token":token},gitlab.const.DEFAULT_URL,token,None),
144+
([], {"oauth_token":token},gitlab.const.DEFAULT_URL,None,token),
145145
([], {"url":localhost},localhost,None,None),
146146
([], {"url":localhost,"private_token":token},localhost,token,None),
147147
([], {"url":localhost,"oauth_token":token},localhost,None,token),
@@ -185,7 +185,7 @@ class MyGitlab(gitlab.Gitlab):
185185
@pytest.mark.parametrize(
186186
"kwargs,expected_agent",
187187
[
188-
({},gitlab.USER_AGENT),
188+
({},gitlab.const.USER_AGENT),
189189
({"user_agent":"my-package/1.0.0"},"my-package/1.0.0"),
190190
],
191191
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp