Skip to content

Commit 0703f0f

Browse files
Update the empty upload command
1 parent e8dce24 commit 0703f0f

File tree

3 files changed

+21
-31
lines changed

3 files changed

+21
-31
lines changed

codecov_cli/commands/empty_upload.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"--pr",
2626
"--pull-request-number",
2727
"pull_request_number",
28-
help="Specify the pull request number mannually. Used to override pre-existing CI environment variables",
28+
help="Specify the pull request number manually. Used to override pre-existing CI environment variables",
2929
cls=CodecovOption,
3030
fallback_field=FallbackFieldEnum.pull_request_number,
3131
)
@@ -55,20 +55,19 @@ def empty_upload(
5555
enterprise_url = ctx.obj.get("enterprise_url")
5656
args = get_cli_args(ctx)
5757

58-
if parent_sha and pull_request_number and branch:
59-
logger.debug("Attempting to Create Commit before doing an empty upload.")
60-
create_commit_logic(
61-
commit_sha,
62-
parent_sha,
63-
pull_request_number,
64-
branch,
65-
slug,
66-
token,
67-
git_service,
68-
enterprise_url,
69-
fail_on_error,
70-
args,
71-
)
58+
logger.debug("Attempting to Create Commit before doing an empty upload.")
59+
create_commit_logic(
60+
commit_sha,
61+
parent_sha,
62+
pull_request_number,
63+
branch,
64+
slug,
65+
token,
66+
git_service,
67+
enterprise_url,
68+
fail_on_error,
69+
args,
70+
)
7271

7372
logger.debug(
7473
"Starting empty upload process",

codecovcli_commands

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ Usage: codecovcli empty-upload [OPTIONS]
151151

152152
Options:
153153
--force
154+
--parent-sha TEXT SHA (with 40 chars) of what should be the
155+
parent of this commit
156+
-P, --pr, --pull-request-number TEXT
157+
Specify the pull request number mannually.
158+
Used to override pre-existing CI environment
159+
variables
160+
-B, --branch TEXT Branch to which this commit belongs to
154161
-C, --sha, --commit-sha TEXT Commit SHA (with 40 chars) [required]
155162
-Z, --fail-on-error Exit with non-zero code in case of error
156163
--git-service [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server]

tests/commands/test_invoke_empty_upload.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,3 @@ def test_invoke_empty_upload_with_create_commit(mocker):
2323
create_commit_mock.assert_called_once()
2424
empty_upload_mock.assert_called_once()
2525

26-
def test_invoke_empty_upload_no_create_commit(mocker):
27-
create_commit_mock = mocker.patch("codecov_cli.commands.empty_upload.create_commit_logic")
28-
empty_upload_mock = mocker.patch("codecov_cli.commands.empty_upload.empty_upload_logic")
29-
30-
fake_ci_provider = FakeProvider({FallbackFieldEnum.commit_sha: None})
31-
mocker.patch("codecov_cli.main.get_ci_adapter", return_value=fake_ci_provider)
32-
33-
runner = CliRunner()
34-
result = runner.invoke(cli, ["empty-upload",
35-
"-C", "command-sha",
36-
"--slug", "owner/repo"], obj={})
37-
assert result.exit_code == 0
38-
39-
create_commit_mock.assert_not_called()
40-
empty_upload_mock.assert_called_once()
41-

0 commit comments

Comments
 (0)