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

Commitcd04315

Browse files
JohnVillalovosnejch
authored andcommitted
test: correct calls toscript_runner.run()
Warnings were being raised. Resolve those warnings.
1 parent5b33ade commitcd04315

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

‎tests/functional/cli/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def _gitlab_cli(subcommands):
1919
# ensure we get strings (e.g from IDs)
2020
command.append(str(subcommand))
2121

22-
returnscript_runner.run(*command)
22+
returnscript_runner.run(command)
2323

2424
return_gitlab_cli
2525

‎tests/functional/cli/test_cli.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@
1919

2020

2121
deftest_main_entrypoint(script_runner,gitlab_config):
22-
ret=script_runner.run("python","-m","gitlab","--config-file",gitlab_config)
22+
ret=script_runner.run(["python","-m","gitlab","--config-file",gitlab_config])
2323
assertret.returncode==2
2424

2525

2626
deftest_version(script_runner):
27-
ret=script_runner.run("gitlab","--version")
27+
ret=script_runner.run(["gitlab","--version"])
2828
assertret.stdout.strip()==__version__
2929

3030

3131
deftest_config_error_with_help_prints_help(script_runner):
32-
ret=script_runner.run("gitlab","-c","invalid-file","--help")
32+
ret=script_runner.run(["gitlab","-c","invalid-file","--help"])
3333
assertret.stdout.startswith("usage:")
3434
assertret.returncode==0
3535

3636

3737
deftest_global_help_prints_resources_vertically(script_runner):
38-
ret=script_runner.run("gitlab","--help")
38+
ret=script_runner.run(["gitlab","--help"])
3939
assert"""resource:\n application\n application-appearance\n"""inret.stdout
4040
assertret.returncode==0
4141

4242

4343
deftest_resource_help_prints_actions_vertically(script_runner):
44-
ret=script_runner.run("gitlab","project","--help")
44+
ret=script_runner.run(["gitlab","project","--help"])
4545
assert"""action:\n list\n get"""inret.stdout
4646
assertret.returncode==0
4747

@@ -51,7 +51,7 @@ def test_resource_help_prints_actions_vertically(script_runner):
5151
deftest_defaults_to_gitlab_com(script_runner,resp_get_project,monkeypatch):
5252
responses.add(**resp_get_project)
5353
monkeypatch.setattr(config,"_DEFAULT_FILES", [])
54-
ret=script_runner.run("gitlab","project","get","--id","1")
54+
ret=script_runner.run(["gitlab","project","get","--id","1"])
5555
assertret.success
5656
assert"id: 1"inret.stdout
5757

@@ -65,7 +65,7 @@ def test_uses_ci_server_url(monkeypatch, script_runner, resp_get_project):
6565
resp_get_project_in_ci.update(url=f"{CI_SERVER_URL}/api/v4/projects/1")
6666

6767
responses.add(**resp_get_project_in_ci)
68-
ret=script_runner.run("gitlab","project","get","--id","1")
68+
ret=script_runner.run(["gitlab","project","get","--id","1"])
6969
assertret.success
7070

7171

@@ -80,7 +80,7 @@ def test_uses_ci_job_token(monkeypatch, script_runner, resp_get_project):
8080
)
8181

8282
responses.add(**resp_get_project_in_ci)
83-
ret=script_runner.run("gitlab","project","get","--id","1")
83+
ret=script_runner.run(["gitlab","project","get","--id","1"])
8484
assertret.success
8585

8686

@@ -104,47 +104,47 @@ def test_private_token_overrides_job_token(
104104

105105
responses.add(**resp_get_project_with_token)
106106
responses.add(**resp_auth_with_token)
107-
ret=script_runner.run("gitlab","project","get","--id","1")
107+
ret=script_runner.run(["gitlab","project","get","--id","1"])
108108
assertret.success
109109

110110

111111
deftest_env_config_missing_file_raises(script_runner,monkeypatch):
112112
monkeypatch.setenv("PYTHON_GITLAB_CFG","non-existent")
113-
ret=script_runner.run("gitlab","project","list")
113+
ret=script_runner.run(["gitlab","project","list"])
114114
assertnotret.success
115115
assertret.stderr.startswith("Cannot read config from PYTHON_GITLAB_CFG")
116116

117117

118118
deftest_arg_config_missing_file_raises(script_runner):
119119
ret=script_runner.run(
120-
"gitlab","--config-file","non-existent","project","list"
120+
["gitlab","--config-file","non-existent","project","list"]
121121
)
122122
assertnotret.success
123123
assertret.stderr.startswith("Cannot read config from file")
124124

125125

126126
deftest_invalid_config(script_runner):
127-
ret=script_runner.run("gitlab","--gitlab","invalid")
127+
ret=script_runner.run(["gitlab","--gitlab","invalid"])
128128
assertnotret.success
129129
assertnotret.stdout
130130

131131

132132
deftest_invalid_config_prints_help(script_runner):
133-
ret=script_runner.run("gitlab","--gitlab","invalid","--help")
133+
ret=script_runner.run(["gitlab","--gitlab","invalid","--help"])
134134
assertret.success
135135
assertret.stdout
136136

137137

138138
deftest_invalid_api_version(script_runner,monkeypatch,fixture_dir):
139139
monkeypatch.setenv("PYTHON_GITLAB_CFG",str(fixture_dir/"invalid_version.cfg"))
140-
ret=script_runner.run("gitlab","--gitlab","test","project","list")
140+
ret=script_runner.run(["gitlab","--gitlab","test","project","list"])
141141
assertnotret.success
142142
assertret.stderr.startswith("Unsupported API version:")
143143

144144

145145
deftest_invalid_auth_config(script_runner,monkeypatch,fixture_dir):
146146
monkeypatch.setenv("PYTHON_GITLAB_CFG",str(fixture_dir/"invalid_auth.cfg"))
147-
ret=script_runner.run("gitlab","--gitlab","test","project","list")
147+
ret=script_runner.run(["gitlab","--gitlab","test","project","list"])
148148
assertnotret.success
149149
assert"401"inret.stderr
150150

‎tests/functional/cli/test_cli_projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_project_registry_delete_in_bulk(
2626
"--name",
2727
".*",
2828
]
29-
ret=ret=script_runner.run(*cmd)
29+
ret=ret=script_runner.run(cmd)
3030
assertret.success
3131

3232

‎tests/functional/cli/test_cli_variables.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def test_list_project_variables_with_path_url_check(script_runner, resp_get_proj
4545

4646
responses.add(**resp_get_project_variables)
4747
ret=script_runner.run(
48-
"gitlab","project-variable","list","--project-id","project/with/a/namespace"
48+
[
49+
"gitlab",
50+
"project-variable",
51+
"list",
52+
"--project-id",
53+
"project/with/a/namespace",
54+
]
4955
)
5056
assertret.success

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp