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
3 changes: 2 additions & 1 deletion codecov_cli/helpers/ci_adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def get_fallback_value(
if fallback_field not in self.fallback_to_method:
raise ValueError("The provided fallback_field is not valid")

return self.fallback_to_method[fallback_field]()
# CI envs are often set but empty; an empty string is "no value", not a value.
return self.fallback_to_method[fallback_field]() or None

def detect(self) -> bool:
"""
Expand Down
7 changes: 7 additions & 0 deletions tests/ci_adapters/test_azure_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ def test_job_code(self, env_dict, expected, mocker):
"123",
),
({AzurePipelinesEnvEnum.SYSTEM_PULLREQUEST_PULLREQUESTID: "111"}, "111"),
(
{
AzurePipelinesEnvEnum.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER: "",
AzurePipelinesEnvEnum.SYSTEM_PULLREQUEST_PULLREQUESTID: "",
},
None,
),
],
)
def test_pull_request_number(self, env_dict, expected, mocker):
Expand Down