From 72fd1b79e0a2079a07daa30fdcca374a4e6d9cba Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Wed, 30 Oct 2024 12:07:11 -0400 Subject: [PATCH 1/7] fix: pass args to send_reports_result_request --- codecov_cli/services/report/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 0b29c9d6..775ae57e 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -2,7 +2,6 @@ import logging import time -import requests from codecov_cli.helpers import request from codecov_cli.helpers.config import CODECOV_API_URL, CODECOV_INGEST_URL @@ -28,7 +27,7 @@ def create_report_logic( enterprise_url: str, pull_request_number: int, fail_on_error: bool = False, - args: dict = None, + args: dict | None = None, ): encoded_slug = encode_slug(slug) sending_result = send_create_report_request( @@ -73,7 +72,7 @@ def create_report_results_logic( token: str, enterprise_url: str, fail_on_error: bool = False, - args: dict = None, + args: dict | None = None, ): encoded_slug = encode_slug(slug) sending_result = send_reports_result_request( @@ -83,6 +82,7 @@ def create_report_results_logic( service=service, token=token, enterprise_url=enterprise_url, + args=args, ) log_warnings_and_errors_if_any( From 1b717b2d41ed26c589084c571ab45a8e654b885a Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Wed, 30 Oct 2024 12:09:12 -0400 Subject: [PATCH 2/7] chore: lint --- codecov_cli/services/report/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 775ae57e..28f73afe 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -2,7 +2,6 @@ import logging import time - from codecov_cli.helpers import request from codecov_cli.helpers.config import CODECOV_API_URL, CODECOV_INGEST_URL from codecov_cli.helpers.encoder import decode_slug, encode_slug From 88d233ea5aa9aafc22fd1efa040d634000b4984f Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Wed, 30 Oct 2024 12:16:18 -0400 Subject: [PATCH 3/7] test: fix tests --- codecov_cli/services/report/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 28f73afe..3e28c697 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -2,6 +2,8 @@ import logging import time +import requests + from codecov_cli.helpers import request from codecov_cli.helpers.config import CODECOV_API_URL, CODECOV_INGEST_URL from codecov_cli.helpers.encoder import decode_slug, encode_slug From 1b866d83c937888e7011f24c171f3d27d1bbea81 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Tue, 5 Nov 2024 12:27:27 -0500 Subject: [PATCH 4/7] fix: typing and tests --- codecov_cli/services/report/__init__.py | 3 ++- tests/services/report/test_report_results.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 3e28c697..dea2a6cf 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -14,6 +14,7 @@ request_result, send_post_request, ) +from typing import Union logger = logging.getLogger("codecovcli") MAX_NUMBER_TRIES = 3 @@ -73,7 +74,7 @@ def create_report_results_logic( token: str, enterprise_url: str, fail_on_error: bool = False, - args: dict | None = None, + args: Union[dict, None] = None, ): encoded_slug = encode_slug(slug) sending_result = send_reports_result_request( diff --git a/tests/services/report/test_report_results.py b/tests/services/report/test_report_results.py index 27808d23..30992f5e 100644 --- a/tests/services/report/test_report_results.py +++ b/tests/services/report/test_report_results.py @@ -43,6 +43,7 @@ def test_report_results_command_with_warnings(mocker): assert res == mock_send_reports_result_request.return_value mock_send_reports_result_request.assert_called_with( + args=None, commit_sha="commit_sha", report_code="code", service="service", @@ -85,6 +86,7 @@ def test_report_results_command_with_error(mocker): ] assert res == mock_send_reports_result_request.return_value mock_send_reports_result_request.assert_called_with( + args=None, commit_sha="commit_sha", report_code="code", service="service", From a9efde75a9dd1a03eeea1a8ba09ca78253f99042 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Mon, 11 Nov 2024 10:15:20 -0500 Subject: [PATCH 5/7] fix: typing --- codecov_cli/services/report/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index dea2a6cf..418b269b 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -29,7 +29,7 @@ def create_report_logic( enterprise_url: str, pull_request_number: int, fail_on_error: bool = False, - args: dict | None = None, + args: Union[dict, None] = None, ): encoded_slug = encode_slug(slug) sending_result = send_create_report_request( From 991f5abbb9f43b10970140064880b795164cf008 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Mon, 11 Nov 2024 11:18:45 -0500 Subject: [PATCH 6/7] chore: make lint --- codecov_cli/services/report/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 418b269b..ee4adf0f 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -1,6 +1,7 @@ import json import logging import time +from typing import Union import requests @@ -14,7 +15,6 @@ request_result, send_post_request, ) -from typing import Union logger = logging.getLogger("codecovcli") MAX_NUMBER_TRIES = 3 From ff6125d848c31dd5b1e93ba37fe94495a814e0f1 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Wed, 13 Nov 2024 14:03:47 -0500 Subject: [PATCH 7/7] fix: simple import typing fix --- codecov_cli/services/report/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codecov_cli/services/report/__init__.py b/codecov_cli/services/report/__init__.py index 4ecdad19..da2b5127 100644 --- a/codecov_cli/services/report/__init__.py +++ b/codecov_cli/services/report/__init__.py @@ -1,7 +1,7 @@ import json import logging import time -from typing import Union +import typing import requests @@ -28,7 +28,7 @@ def create_report_logic( enterprise_url: str, pull_request_number: int, fail_on_error: bool = False, - args: Union[dict, None] = None, + args: typing.Union[dict, None] = None, ): encoded_slug = encode_slug(slug) sending_result = send_create_report_request( @@ -73,7 +73,7 @@ def create_report_results_logic( token: typing.Optional[str], enterprise_url: str, fail_on_error: bool = False, - args: Union[dict, None] = None, + args: typing.Union[dict, None] = None, ): encoded_slug = encode_slug(slug) sending_result = send_reports_result_request(