Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions codecov_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
@click.option(
"--disable-telem", help="Disable sending telemetry data to Codecov", is_flag=True
)
@click.option(
"--wrapper",
help="Identifier of the integration invoking the CLI, e.g. codecov-action-7.1.1",
)
@click.pass_context
@click.version_option(__version__, prog_name="codecovcli")
def cli(
Expand All @@ -57,6 +61,7 @@ def cli(
enterprise_url: str,
verbose: bool = False,
disable_telem: bool = False,
wrapper: typing.Optional[str] = None,
):
ctx.obj["cli_args"] = ctx.params
ctx.obj["cli_args"]["version"] = f"cli-{__version__}"
Expand Down
2 changes: 2 additions & 0 deletions codecovcli_commands
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Options:
Change the upload host (Enterprise use)
-v, --verbose Use verbose logging
--disable-telem Disable sending telemetry data to Codecov
--wrapper TEXT Identifier of the integration invoking the
CLI, e.g. codecov-action-7.1.1
--version Show the version and exit.
--help Show this message and exit.

Expand Down
29 changes: 29 additions & 0 deletions tests/commands/test_invoke_empty_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,32 @@ def test_invoke_empty_upload_with_create_commit(mocker):
create_commit_mock.assert_called_once()
empty_upload_mock.assert_called_once()



def test_invoke_empty_upload_reports_wrapper_in_cli_args(mocker):
mocker.patch("codecov_cli.commands.empty_upload.create_commit_logic")
empty_upload_mock = mocker.patch(
"codecov_cli.commands.empty_upload.empty_upload_logic"
)

fake_ci_provider = FakeProvider({FallbackFieldEnum.commit_sha: None})
mocker.patch("codecov_cli.main.get_ci_adapter", return_value=fake_ci_provider)

runner = CliRunner()
result = runner.invoke(
cli,
[
"--wrapper",
"codecov-action-7.1.1",
"empty-upload",
"-C",
"command-sha",
"--slug",
"owner/repo",
],
obj={},
)
assert result.exit_code == 0

cli_args = empty_upload_mock.call_args.args[-1]
assert cli_args["wrapper"] == "codecov-action-7.1.1"
Loading