From 13a87ce7acf1e316abb6ade0fa5c2326f5c2b857 Mon Sep 17 00:00:00 2001 From: JerrySentry <142266253+JerrySentry@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:14:38 -0400 Subject: [PATCH] Bundle Analysis: associate past assets to current parsed bundle (#486) --- requirements.in | 2 +- requirements.txt | 2 +- services/ai_pr_review.py | 2 +- services/bundle_analysis.py | 40 + .../notification/notifiers/checks/base.py | 4 +- .../notifiers/comment/__init__.py | 12 +- .../notifiers/mixins/message/__init__.py | 2 +- .../notifiers/mixins/message/helpers.py | 5 +- .../notification/notifiers/mixins/status.py | 2 +- .../tests/integration/test_comment.py | 8 +- .../notifiers/tests/unit/test_checks.py | 66 +- .../notifiers/tests/unit/test_comment.py | 1152 ++++++++--------- .../notifiers/tests/unit/test_status.py | 6 +- .../tests/unit/test_notification_service.py | 2 +- services/report/__init__.py | 4 +- services/tests/test_bots.py | 4 +- services/tests/test_urls.py | 4 +- tasks/send_email.py | 6 +- tasks/tests/integration/test_notify_task.py | 4 +- ...st_backfill_commit_data_to_storage_task.py | 2 +- ..._backfill_existing_gh_app_installations.py | 4 +- .../test_bundle_analysis_processor_task.py | 297 ++++- tasks/tests/unit/test_clean_labels_index.py | 2 +- .../tests/unit/test_test_results_finisher.py | 2 +- tasks/upload.py | 2 +- tasks/upload_finisher.py | 2 +- 26 files changed, 983 insertions(+), 655 deletions(-) diff --git a/requirements.in b/requirements.in index 25db57cf6..89551a430 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -https://github.com/codecov/shared/archive/bef1d469b14f19d530c60993872045ce538dd3aa.tar.gz#egg=shared +https://github.com/codecov/shared/archive/57e53e8dee5cc499a72ece349a66f4174c8af236.tar.gz#egg=shared https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem https://github.com/codecov/test-results-parser/archive/5515e960d5d38881036e9127f86320efca649f13.tar.gz#egg=test-results-parser boto3>=1.34 diff --git a/requirements.txt b/requirements.txt index a0f242f00..148a30ddd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -368,7 +368,7 @@ sentry-sdk==1.40.0 # via # -r requirements.in # shared -shared @ https://github.com/codecov/shared/archive/bef1d469b14f19d530c60993872045ce538dd3aa.tar.gz +shared @ https://github.com/codecov/shared/archive/57e53e8dee5cc499a72ece349a66f4174c8af236.tar.gz # via -r requirements.in six==1.16.0 # via diff --git a/services/ai_pr_review.py b/services/ai_pr_review.py index 2ad6d44c4..e4ce7aeb9 100644 --- a/services/ai_pr_review.py +++ b/services/ai_pr_review.py @@ -294,7 +294,7 @@ async def perform(self) -> Optional[int]: if len(self.review_ids) > 0: comments_to_update = [] async for comment in self.pull_wrapper.fetch_review_comments(): - if not (comment["pull_request_review_id"] in self.review_ids): + if comment["pull_request_review_id"] not in self.review_ids: continue line_info = LineInfo( diff --git a/services/bundle_analysis.py b/services/bundle_analysis.py index fd0fd5197..6274ca0e0 100644 --- a/services/bundle_analysis.py +++ b/services/bundle_analysis.py @@ -123,6 +123,41 @@ async def initialize_and_save_report( db_session.flush() return commit_report + def _previous_bundle_analysis_report( + self, bundle_loader: BundleAnalysisReportLoader, commit: Commit + ) -> Optional[BundleAnalysisReport]: + """ + Helper function to fetch the parent commit's BAR for the purpose of matching previous bundle's + Assets to the current one being parsed. + """ + if commit.parent_commit_id is None: + return None + + db_session = commit.get_db_session() + parent_commit = ( + db_session.query(Commit) + .filter_by( + commitid=commit.parent_commit_id, + repository=commit.repository, + ) + .first() + ) + if parent_commit is None: + return None + + parent_commit_report = ( + db_session.query(CommitReport) + .filter_by( + commit_id=parent_commit.id_, + report_type=ReportType.BUNDLE_ANALYSIS.value, + ) + .first() + ) + if parent_commit_report is None: + return None + + return bundle_loader.load(parent_commit_report.external_id) + @sentry_sdk.trace def process_upload(self, commit: Commit, upload: Upload) -> ProcessingResult: """ @@ -151,6 +186,11 @@ def process_upload(self, commit: Commit, upload: Upload) -> ProcessingResult: # load the downloaded data into the bundle report session_id = bundle_report.ingest(local_path) + # Retrieve previous commit's BAR and associate past Assets + prev_bar = self._previous_bundle_analysis_report(bundle_loader, commit) + if prev_bar: + bundle_report.associate_previous_assets(prev_bar) + # save the bundle report back to storage bundle_loader.save(bundle_report, commit_report.external_id) except FileNotInStorageError: diff --git a/services/notification/notifiers/checks/base.py b/services/notification/notifiers/checks/base.py index 1a1f1e2fe..c575bf234 100644 --- a/services/notification/notifiers/checks/base.py +++ b/services/notification/notifiers/checks/base.py @@ -55,8 +55,8 @@ def get_upgrade_message(self, comparison: Comparison) -> str: [ f"The author of this PR, {author_username}, is not an activated member of this organization on Codecov.", f"Please [activate this user on Codecov]({links['members_url']}) to display a detailed status check.", - f"Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", - f"Please don't hesitate to email us at support@codecov.io with any questions.", + "Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", + "Please don't hesitate to email us at support@codecov.io with any questions.", ] ) diff --git a/services/notification/notifiers/comment/__init__.py b/services/notification/notifiers/comment/__init__.py index 5f9c157ff..6a2083d17 100644 --- a/services/notification/notifiers/comment/__init__.py +++ b/services/notification/notifiers/comment/__init__.py @@ -413,8 +413,8 @@ def _create_reached_upload_limit_message(self, comparison): f"This org is currently on the free Basic Plan; which includes 250 free private repo uploads each rolling month.\ This limit has been reached and additional reports cannot be generated. For unlimited uploads,\ upgrade to our [pro plan]({links['plan_url']}).", - f"", - f"**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", + "", + "**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", ] def _create_upgrade_message(self, comparison): @@ -430,15 +430,15 @@ def _create_upgrade_message(self, comparison): return [ f"The author of this PR, {author_username}, is not an activated member of this organization on Codecov.", f"Please [activate this user on Codecov]({links['members_url_cloud']}) to display this PR comment.", - f"Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", - f"Please don't hesitate to email us at support@codecov.io with any questions.", + "Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", + "Please don't hesitate to email us at support@codecov.io with any questions.", ] else: return [ f"The author of this PR, {author_username}, is not activated in your Codecov Self-Hosted installation.", f"Please [activate this user]({links['members_url_self_hosted']}) to display this PR comment.", - f"Coverage data is still being uploaded to Codecov Self-Hosted for the purposes of overall coverage calculations.", - f"Please contact your Codecov On-Premises installation administrator with any questions.", + "Coverage data is still being uploaded to Codecov Self-Hosted for the purposes of overall coverage calculations.", + "Please contact your Codecov On-Premises installation administrator with any questions.", ] def _create_processing_upload_message(self): diff --git a/services/notification/notifiers/mixins/message/__init__.py b/services/notification/notifiers/mixins/message/__init__.py index beb29e6a9..f97258c7f 100644 --- a/services/notification/notifiers/mixins/message/__init__.py +++ b/services/notification/notifiers/mixins/message/__init__.py @@ -260,7 +260,7 @@ def get_middle_layout_section_names(self, settings): def get_upper_section_names(self, settings): sections = list(map(lambda l: l.strip(), (settings["layout"] or "").split(","))) headers = ["newheader", "header", "condensed_header"] - if all(not x in sections for x in headers): + if all(x not in sections for x in headers): sections.insert(0, "condensed_header") return [ diff --git a/services/notification/notifiers/mixins/message/helpers.py b/services/notification/notifiers/mixins/message/helpers.py index 06044e5cc..61408b00e 100644 --- a/services/notification/notifiers/mixins/message/helpers.py +++ b/services/notification/notifiers/mixins/message/helpers.py @@ -293,7 +293,10 @@ def _row(title, c1, c2, plus="+", minus="-", neutral=" "): spacer = ["=" * row_w] title = "@@%s@@" % "{text:{fill}{align}{width}}".format( - text="Coverage Diff", fill=" ", align="^", width=row_w - 4, strip=True + text="Coverage Diff", + fill=" ", + align="^", + width=row_w - 4, ) table = ( diff --git a/services/notification/notifiers/mixins/status.py b/services/notification/notifiers/mixins/status.py index de80f2268..61cddc0d2 100644 --- a/services/notification/notifiers/mixins/status.py +++ b/services/notification/notifiers/mixins/status.py @@ -142,7 +142,7 @@ async def _apply_removals_only_behavior( ) ) if no_added_no_unexpected_change and some_removed: - return ("success", f", passed because this change only removed code") + return ("success", ", passed because this change only removed code") return None async def _apply_adjust_base_behavior( diff --git a/services/notification/notifiers/tests/integration/test_comment.py b/services/notification/notifiers/tests/integration/test_comment.py index b913d459c..2d630d566 100644 --- a/services/notification/notifiers/tests/integration/test_comment.py +++ b/services/notification/notifiers/tests/integration/test_comment.py @@ -543,12 +543,12 @@ async def test_notify_upload_limited( assert result.notification_successful assert result.explanation is None expected_message = [ - f"## [Codecov](https://app.codecov.io/plan/gh/test-acc9) upload limit reached :warning:", - f"This org is currently on the free Basic Plan; which includes 250 free private repo uploads each rolling month.\ + "## [Codecov](https://app.codecov.io/plan/gh/test-acc9) upload limit reached :warning:", + "This org is currently on the free Basic Plan; which includes 250 free private repo uploads each rolling month.\ This limit has been reached and additional reports cannot be generated. For unlimited uploads,\ upgrade to our [pro plan](https://app.codecov.io/plan/gh/test-acc9).", - f"", - f"**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", + "", + "**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", ] for exp, res in zip(result.data_sent["message"], expected_message): assert exp == res diff --git a/services/notification/notifiers/tests/unit/test_checks.py b/services/notification/notifiers/tests/unit/test_checks.py index f81e26b96..c41ecf4f2 100644 --- a/services/notification/notifiers/tests/unit/test_checks.py +++ b/services/notification/notifiers/tests/unit/test_checks.py @@ -964,7 +964,7 @@ async def test_send_notification( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, "url": "https://app.codecov.io/gh/codecov/worker/compare/100?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term=codecov", } mock_repo_provider.create_check_run.return_value = 2234563 @@ -994,7 +994,7 @@ async def test_send_notification_annotations_paginations( "state": "success", "output": { "title": "Codecov Report", - "summary": f"Summary", + "summary": "Summary", "annotations": list(range(1, 61, 1)), }, } @@ -1035,7 +1035,7 @@ async def test_send_notification_annotations_paginations( "state": "success", "output": { "title": "Codecov Report", - "summary": f"Summary", + "summary": "Summary", "annotations": list(range(1, 61, 1)), }, } @@ -1048,7 +1048,7 @@ async def test_notify( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, } mock_repo_provider.create_check_run.return_value = 2234563 mock_repo_provider.update_check_run.return_value = "success" @@ -1364,13 +1364,13 @@ async def test_analytics_url( [ f"## [Codecov](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", f"> Merging [#{sample_comparison.pull.pullid}](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) ({head_commit.commitid[:7]}) into [master](codecov.io/gh/test_build_default_payload/{repo.name}/commit/{sample_comparison.project_coverage_base.commit.commitid}?el=desc) ({base_commit.commitid[:7]}) will **increase** coverage by `10.00%`.", - f"> The diff coverage is `66.67%`.", - f"", + "> The diff coverage is `66.67%`.", + "", f"| [Files](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", f"| [file\\_2.py](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_2.py#diff-ZmlsZV8yLnB5) | `50.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |", - f"", + "", ] ), }, @@ -1392,13 +1392,13 @@ async def test_analytics_url( [ f"## [Codecov](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}) Report", f"> Merging [#{sample_comparison.pull.pullid}](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}) ({head_commit.commitid[:7]}) into [master](codecov.io/gh/test_build_default_payload/{repo.name}/commit/{sample_comparison.project_coverage_base.commit.commitid}?el=desc&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}) ({base_commit.commitid[:7]}) will **increase** coverage by `10.00%`.", - f"> The diff coverage is `66.67%`.", - f"", + "> The diff coverage is `66.67%`.", + "", f"| [Files](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_1.go&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", f"| [file\\_2.py](codecov.io/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_2.py&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term={quote_plus(repo.owner.name)}#diff-ZmlsZV8yLnB5) | `50.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |", - f"", + "", ] ), }, @@ -1511,13 +1511,13 @@ async def test_build_default_payload( "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc)." f"", - f"", + "", f"| [Files](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", + "", ] ), }, @@ -1554,13 +1554,13 @@ async def test_build_default_payload_with_flags( "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc)." f"", - f"", + "", f"| [Files](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", + "", ] ), }, @@ -1597,20 +1597,20 @@ async def test_build_default_payload_with_flags_and_footer( f"## [Codecov](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"| [Files](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in Codecov by Sentry](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by [Codecov](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=footer). Last update [{base_commit.commitid[:7]}...{head_commit.commitid[:7]}](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] ), }, @@ -1726,7 +1726,7 @@ async def test_check_notify_no_path_match( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, } mock_repo_provider.create_check_run.return_value = 2234563 mock_repo_provider.update_check_run.return_value = "success" @@ -1760,7 +1760,7 @@ async def test_check_notify_single_path_match( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, } mock_repo_provider.create_check_run.return_value = 2234563 mock_repo_provider.update_check_run.return_value = "success" @@ -1801,7 +1801,7 @@ async def test_check_notify_multiple_path_match( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, } mock_repo_provider.create_check_run.return_value = 2234563 mock_repo_provider.update_check_run.return_value = "success" @@ -1836,7 +1836,7 @@ async def test_check_notify_with_paths( comparison = sample_comparison payload = { "state": "success", - "output": {"title": "Codecov Report", "summary": f"Summary"}, + "output": {"title": "Codecov Report", "summary": "Summary"}, } mock_repo_provider.create_check_run.return_value = 2234563 mock_repo_provider.update_check_run.return_value = "success" diff --git a/services/notification/notifiers/tests/unit/test_comment.py b/services/notification/notifiers/tests/unit/test_comment.py index fd04e9770..eb3281d7e 100644 --- a/services/notification/notifiers/tests/unit/test_comment.py +++ b/services/notification/notifiers/tests/unit/test_comment.py @@ -748,12 +748,12 @@ async def test_create_message_files_section( f"## [Codecov](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](https://app.codecov.io/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](https://app.codecov.io/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"| [Files](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <ø> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", f"| [file\\_2.py](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_2.py#diff-ZmlsZV8yLnB5) | `50.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |", - f"", + "", ] res = await notifier.create_message(comparison, pull_dict, {"layout": "files"}) for expected, res in zip(expected_result, res): @@ -909,10 +909,10 @@ async def test_create_message_files_section_with_critical_files( "Changes have been made to critical files, which contain lines commonly executed in production. [Learn more](https://docs.codecov.com/docs/impact-analysis)", "", f"| [Files](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <ø> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", f"| [file\\_2.py](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_2.py#diff-ZmlsZV8yLnB5) **Critical** | `50.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |", - f"", + "", "", ] res = await notifier.build_message(comparison) @@ -942,51 +942,51 @@ async def test_build_message( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{sample_comparison.project_coverage_base.commit.commitid[:7]}...{sample_comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1016,7 +1016,7 @@ async def test_build_message_flags_empty_coverage( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 100.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | |", "|---|---|---|", f"| [eighth](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | |", @@ -1065,59 +1065,59 @@ async def test_build_message_more_sections( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{sample_comparison.project_coverage_base.commit.commitid[:7]}...{sample_comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", - f"", - f"", - f"", - f"", - f"", - f"", + "", + "", + "", + "", + "", + "", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1151,8 +1151,8 @@ async def test_build_upgrade_message( expected_result = [ f"The author of this PR, {provider_pull['author']['username']}, is not an activated member of this organization on Codecov.", f"Please [activate this user on Codecov](test.example.br/members/gh/{pull.repository.owner.username}) to display this PR comment.", - f"Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", - f"Please don't hesitate to email us at support@codecov.io with any questions.", + "Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.", + "Please don't hesitate to email us at support@codecov.io with any questions.", ] li = 0 for exp, res in zip(expected_result, result): @@ -1191,8 +1191,8 @@ async def test_build_limited_upload_message( f"This org is currently on the free Basic Plan; which includes 250 free private repo uploads each rolling month.\ This limit has been reached and additional reports cannot be generated. For unlimited uploads,\ upgrade to our [pro plan](test.example.br/plan/gh/{pull.repository.owner.username}).", - f"", - f"**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", + "", + "**Do you have questions or need help?** Connect with our sales team today at ` sales@codecov.io `", ] li = 0 for exp, res in zip(expected_result, result): @@ -1336,8 +1336,8 @@ async def test_build_upgrade_message_enterprise( expected_result = [ f"The author of this PR, {provider_pull['author']['username']}, is not activated in your Codecov Self-Hosted installation.", f"Please [activate this user](https://codecov.mysite.com/account/gh/{pull.author.username}) to display this PR comment.", - f"Coverage data is still being uploaded to Codecov Self-Hosted for the purposes of overall coverage calculations.", - f"Please contact your Codecov On-Premises installation administrator with any questions.", + "Coverage data is still being uploaded to Codecov Self-Hosted for the purposes of overall coverage calculations.", + "Please contact your Codecov On-Premises installation administrator with any questions.", ] li = 0 for exp, res in zip(expected_result, result): @@ -1365,51 +1365,51 @@ async def test_build_message_hide_complexity( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | |", - f"|---|---|---|", + "|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | |", - f"|---|---|---|", + "|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{sample_comparison.project_coverage_base.commit.commitid[:7]}...{sample_comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1439,48 +1439,48 @@ async def test_build_message_no_base_report( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@{comparison.project_coverage_base.commit.commitid[:7]}`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=========================================", - f" Coverage ? 60.00% ", - f" Complexity ? 10 ", - f"=========================================", - f" Files ? 2 ", - f" Lines ? 10 ", - f" Branches ? 1 ", - f"=========================================", - f" Hits ? 6 ", - f" Misses ? 3 ", - f" Partials ? 1 ", - f"```", - f"", + "=========================================", + " Coverage ? 60.00% ", + " Complexity ? 10 ", + "=========================================", + " Files ? 2 ", + " Lines ? 10 ", + " Branches ? 1 ", + "=========================================", + " Hits ? 6 ", + " Misses ? 3 ", + " Partials ? 1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (ø)` | `10.00 <0.00> (?)` | |", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1509,49 +1509,49 @@ async def test_build_message_no_base_commit( expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", - f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@cdf9aa4`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", - f"", + "> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@cdf9aa4`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=========================================", - f" Coverage ? 60.00% ", - f" Complexity ? 10 ", - f"=========================================", - f" Files ? 2 ", - f" Lines ? 10 ", - f" Branches ? 1 ", - f"=========================================", - f" Hits ? 6 ", - f" Misses ? 3 ", - f" Partials ? 1 ", - f"```", - f"", + "=========================================", + " Coverage ? 60.00% ", + " Complexity ? 10 ", + "=========================================", + " Files ? 2 ", + " Lines ? 10 ", + " Branches ? 1 ", + "=========================================", + " Hits ? 6 ", + " Misses ? 3 ", + " Partials ? 1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (ø)` | `10.00 <0.00> (?)` | |", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[cdf9aa4...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1583,48 +1583,48 @@ async def test_build_message_no_change( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=========================================", - f" Coverage 60.00% 60.00% ", - f" Complexity 10 10 ", - f"=========================================", - f" Files 2 2 ", - f" Lines 10 10 ", - f" Branches 1 1 ", - f"=========================================", - f" Hits 6 6 ", - f" Misses 3 3 ", - f" Partials 1 1 ", - f"```", - f"", + "=========================================", + " Coverage 60.00% 60.00% ", + " Complexity 10 10 ", + "=========================================", + " Files 2 2 ", + " Lines 10 10 ", + " Branches 1 1 ", + "=========================================", + " Hits 6 6 ", + " Misses 3 3 ", + " Partials 1 1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (ø)` | `10.00 <0.00> (ø)` | |", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{sample_comparison_no_change.project_coverage_base.commit.commitid[:7]}...{sample_comparison_no_change.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -1656,51 +1656,51 @@ async def test_build_message_negative_change( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 50.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"- Coverage 60.00% 50.00% -10.00% ", - f"- Complexity 10 11 +1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 10 6 -4 ", - f" Branches 1 0 -1 ", - f"=============================================", - f"- Hits 6 3 -3 ", - f" Misses 3 3 ", - f"+ Partials 1 0 -1 ", - f"```", - f"", + "=============================================", + "- Coverage 60.00% 50.00% -10.00% ", + "- Complexity 10 11 +1 ", + "=============================================", + " Files 2 2 ", + " Lines 10 6 -4 ", + " Branches 1 0 -1 ", + "=============================================", + "- Hits 6 3 -3 ", + " Misses 3 3 ", + "+ Partials 1 0 -1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <ø> (?)` | `0.00 <ø> (?)` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `50.00% <ø> (-12.50%)` | `11.00 <0.00> (+1.00)` | :arrow_down: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1752,20 +1752,20 @@ async def test_build_message_negative_change_tricky_rounding( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 88.54%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"==========================================", - f"- Coverage 88.58% 88.54% -0.04% ", - f"==========================================", - f" Files 1 1 ", - f" Lines 7630 7631 +1 ", - f"==========================================", - f"- Hits 6759 6757 -2 ", - f"- Misses 871 874 +3 ", - f"```", - f"", + "==========================================", + "- Coverage 88.58% 88.54% -0.04% ", + "==========================================", + " Files 1 1 ", + " Lines 7630 7631 +1 ", + "==========================================", + "- Hits 6759 6757 -2 ", + "- Misses 871 874 +3 ", + "```", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -1817,9 +1817,9 @@ async def test_build_message_negative_change_tricky_rounding_newheader( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"All modified and coverable lines are covered by tests :white_check_mark:", + "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 88.54%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -1850,49 +1850,49 @@ async def test_build_message_show_carriedforward_flags_no_cf_coverage( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{sample_comparison.project_coverage_base.commit.commitid[:7]}...{sample_comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -1926,37 +1926,37 @@ async def test_build_message_with_without_flags( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 65.38%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=======================================", - f" Coverage 65.38% 65.38% ", - f"=======================================", - f" Files 15 15 ", - f" Lines 208 208 ", - f"=======================================", - f" Hits 136 136 ", - f" Misses 4 4 ", - f" Partials 68 68 ", - f"```", - f"", - f"", - f"------", - f"", + "=======================================", + " Coverage 65.38% 65.38% ", + "=======================================", + " Files 15 15 ", + " Lines 208 208 ", + "=======================================", + " Hits 136 136 ", + " Misses 4 4 ", + " Partials 68 68 ", + "```", + "", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -1984,46 +1984,46 @@ async def test_build_message_with_without_flags( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 65.38%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=======================================", - f" Coverage 65.38% 65.38% ", - f"=======================================", - f" Files 15 15 ", - f" Lines 208 208 ", - f"=======================================", - f" Hits 136 136 ", - f" Misses 4 4 ", - f" Partials 68 68 ", - f"```", - f"", + "=======================================", + " Coverage 65.38% 65.38% ", + "=======================================", + " Files 15 15 ", + " Lines 208 208 ", + "=======================================", + " Hits 136 136 ", + " Misses 4 4 ", + " Partials 68 68 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | | *Carryforward flag |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [enterprise](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | Carriedforward from [1234567](test.example.br/gh/{repository.slug}/commit/123456789sha) |", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | Carriedforward |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | |", - f"", - f"*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags) to find out more." - f"", - f"", - f"", - f"------", - f"", + "", + "*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags) to find out more." + "", + "", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -2058,46 +2058,46 @@ async def test_build_message_show_carriedforward_flags_has_cf_coverage( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 65.38%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=======================================", - f" Coverage 65.38% 65.38% ", - f"=======================================", - f" Files 15 15 ", - f" Lines 208 208 ", - f"=======================================", - f" Hits 136 136 ", - f" Misses 4 4 ", - f" Partials 68 68 ", - f"```", - f"", + "=======================================", + " Coverage 65.38% 65.38% ", + "=======================================", + " Files 15 15 ", + " Lines 208 208 ", + "=======================================", + " Hits 136 136 ", + " Misses 4 4 ", + " Partials 68 68 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | | *Carryforward flag |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [enterprise](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | Carriedforward from [1234567](test.example.br/gh/{repository.slug}/commit/123456789sha) |", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | Carriedforward |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | | |", - f"", - f"*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags) to find out more." - f"", - f"", - f"", - f"------", - f"", + "", + "*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags) to find out more." + "", + "", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -2132,44 +2132,44 @@ async def test_build_message_hide_carriedforward_flags_has_cf_coverage( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 65.38%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=======================================", - f" Coverage 65.38% 65.38% ", - f"=======================================", - f" Files 15 15 ", - f" Lines 208 208 ", - f"=======================================", - f" Hits 136 136 ", - f" Misses 4 4 ", - f" Partials 68 68 ", - f"```", - f"", + "=======================================", + " Coverage 65.38% 65.38% ", + "=======================================", + " Files 15 15 ", + " Lines 208 208 ", + "=======================================", + " Hits 136 136 ", + " Misses 4 4 ", + " Partials 68 68 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | |", - f"|---|---|---|", + "|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more." - f"", - f"", - f"", - f"------", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more." + "", + "", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -2231,50 +2231,50 @@ async def test_build_message_no_flags( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", - f"", + "", f"... and [1 file with indirect coverage changes](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/indirect-changes?src=pr&el=tree-more)", - f"", - f"------", - f"", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -3286,12 +3286,12 @@ async def test_message_hide_details_github( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", - f"
Additional details and impacted files\n", - f"", + "", + "
Additional details and impacted files\n", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"
", + "", + "
", ] li = 0 for exp, res in zip(expected_result, result): @@ -3357,9 +3357,9 @@ async def test_message_hide_details_bitbucket( f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", + "", ] li = 0 for exp, res in zip(expected_result, result): @@ -3450,7 +3450,7 @@ async def test_filesection_no_extra_settings(self, sample_comparison, mocker): "| [Files](pull.link?dropdown=coverage&src=pr&el=tree) | Coverage Δ | |", "|---|---|---|", "| [file\\_1.go](pull.link?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.66%> (+12.50%)` | :arrow_up: |", - f"", + "", "... and [3 files with indirect coverage changes](pull.link/indirect-changes?src=pr&el=tree-more)", ] @@ -4459,16 +4459,16 @@ async def test_create_message_files_section_with_critical_files_new_layout( repository = sample_comparison.head.commit.repository expected_result = [ f"## [Codecov](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"All modified and coverable lines are covered by tests :white_check_mark:", + "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 60.00%. Comparing base [(`{sample_comparison.project_coverage_base.commit.commitid[:7]}`)](https://app.codecov.io/gh/{repository.slug}/commit/{sample_comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{sample_comparison.head.commit.commitid[:7]}`)](https://app.codecov.io/gh/{repository.slug}/commit/{sample_comparison.head.commit.commitid}?dropdown=coverage&el=desc).", "", "Changes have been made to critical files, which contain lines commonly executed in production. [Learn more](https://docs.codecov.com/docs/impact-analysis)", "", f"| [Files](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\\_1.go](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <ø> (+12.50%)` | `10.00 <0.00> (-1.00)` | :arrow_up: |", f"| [file\\_2.py](https://app.codecov.io/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_2.py#diff-ZmlsZV8yLnB5) **Critical** | `50.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |", - f"", + "", "", ] res = await notifier.build_message(comparison) @@ -4503,41 +4503,41 @@ async def test_build_message_no_base_commit_new_layout( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", - f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@cdf9aa4`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", - f"", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@cdf9aa4`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=========================================", - f" Coverage ? 60.00% ", - f" Complexity ? 10 ", - f"=========================================", - f" Files ? 2 ", - f" Lines ? 10 ", - f" Branches ? 1 ", - f"=========================================", - f" Hits ? 6 ", - f" Misses ? 3 ", - f" Partials ? 1 ", - f"```", - f"", + "=========================================", + " Coverage ? 60.00% ", + " Complexity ? 10 ", + "=========================================", + " Files ? 2 ", + " Lines ? 10 ", + " Branches ? 1 ", + "=========================================", + " Hits ? 6 ", + " Misses ? 3 ", + " Partials ? 1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (ø)` | `10.00 <0.00> (?)` | |", - f"", - f"", + "", + "", f"[:umbrella: View full report in Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue). ", - f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", - f"", + ":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -4569,44 +4569,44 @@ async def test_build_message_no_base_report_new_layout( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`master@{comparison.project_coverage_base.commit.commitid[:7]}`). [Learn more](https://docs.codecov.io/docs/error-reference#section-missing-base-commit) about missing BASE report.", - f"", - f"
Additional details and impacted files\n", - f"", + "", + "
Additional details and impacted files\n", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=========================================", - f" Coverage ? 60.00% ", - f" Complexity ? 10 ", - f"=========================================", - f" Files ? 2 ", - f" Lines ? 10 ", - f" Branches ? 1 ", - f"=========================================", - f" Hits ? 6 ", - f" Misses ? 3 ", - f" Partials ? 1 ", - f"```", - f"", + "=========================================", + " Coverage ? 60.00% ", + " Complexity ? 10 ", + "=========================================", + " Files ? 2 ", + " Lines ? 10 ", + " Branches ? 1 ", + "=========================================", + " Hits ? 6 ", + " Misses ? 3 ", + " Partials ? 1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [file\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | `62.50% <66.67%> (ø)` | `10.00 <0.00> (?)` | |", - f"", - f"
", - f"", + "", + "
", + "", f"[:umbrella: View full report in Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue). ", - f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", - f"", + ":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -4639,15 +4639,15 @@ async def test_build_message_no_project_coverage( pull_url = f"test.example.br/gh/{repository.slug}/pull/{pull.pullid}" expected_result = [ f"## [Codecov]({pull_url}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", - f"", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "", f"| [Files]({pull_url}?dropdown=coverage&src=pr&el=tree) | Patch % | Lines |", - f"|---|---|---|", + "|---|---|---|", f"| [file\\_1.go]({pull_url}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | 66.67% | [1 Missing :warning: ]({pull_url}?src=pr&el=tree) |", - f"", - f"", - f":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/)", - f"", + "", + "", + ":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/)", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -4680,15 +4680,15 @@ async def test_build_message_no_project_coverage_condensed_yaml_configs( pull_url = f"test.example.br/gh/{repository.slug}/pull/{pull.pullid}" expected_result = [ f"## [Codecov]({pull_url}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", - f"", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "", f"| [Files]({pull_url}?dropdown=coverage&src=pr&el=tree) | Patch % | Lines |", - f"|---|---|---|", + "|---|---|---|", f"| [file\\_1.go]({pull_url}?src=pr&el=tree&filepath=file_1.go#diff-ZmlsZV8xLmdv) | 66.67% | [1 Missing :warning: ]({pull_url}?src=pr&el=tree) |", - f"", - f"", - f":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/)", - f"", + "", + "", + ":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/)", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -4720,45 +4720,45 @@ async def test_build_message_head_and_pull_head_differ_new_layout( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"> :exclamation: **Current head {comparison.head.commit.commitid[:7]} differs from pull request most recent head {comparison.enriched_pull.provider_pull['head']['commitid'][:7]}**", - f"> ", + "> ", f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) reports for the commit {comparison.enriched_pull.provider_pull['head']['commitid'][:7]} to get more accurate results.", - f"", - f"
Additional details and impacted files\n", - f"", + "", + "
Additional details and impacted files\n", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", - f"
", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", + "
", + "", f"[:umbrella: View full report in Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue). ", - f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", - f"", + ":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -4797,50 +4797,50 @@ async def test_build_message_head_and_pull_head_differ_with_components( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", + "Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.", f"> Project coverage is 60.00%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"> :exclamation: **Current head {comparison.head.commit.commitid[:7]} differs from pull request most recent head {comparison.enriched_pull.provider_pull['head']['commitid'][:7]}**", - f"> ", + "> ", f"> Please [upload](https://docs.codecov.com/docs/codecov-uploader) reports for the commit {comparison.enriched_pull.provider_pull['head']['commitid'][:7]} to get more accurate results.", - f"", - f"
Additional details and impacted files\n", - f"", + "", + "
Additional details and impacted files\n", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=============================================", - f"+ Coverage 50.00% 60.00% +10.00% ", - f"+ Complexity 11 10 -1 ", - f"=============================================", - f" Files 2 2 ", - f" Lines 6 10 +4 ", - f" Branches 0 1 +1 ", - f"=============================================", - f"+ Hits 3 6 +3 ", - f" Misses 3 3 ", - f"- Partials 0 1 +1 ", - f"```", - f"", + "=============================================", + "+ Coverage 50.00% 60.00% +10.00% ", + "+ Complexity 11 10 -1 ", + "=============================================", + " Files 2 2 ", + " Lines 6 10 +4 ", + " Branches 0 1 +1 ", + "=============================================", + "+ Hits 3 6 +3 ", + " Misses 3 3 ", + "- Partials 0 1 +1 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | Complexity Δ | |", - f"|---|---|---|---|", + "|---|---|---|---|", f"| [integration](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `?` | `?` | |", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `100.00% <100.00%> (?)` | `0.00 <0.00> (?)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.", + "", f"| [Components](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/components?src=pr&el=components) | Coverage Δ | |", - f"|---|---|---|", + "|---|---|---|", f"| [go_files](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/components?src=pr&el=component) | `62.50% <66.67%> (+12.50%)` | :arrow_up: |", f"| [unit_flags](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/components?src=pr&el=component) | `100.00% <100.00%> (∅)` | |", - f"", - f"
", - f"", + "", + "
", + "", f"[:umbrella: View full report in Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue). ", - f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", - f"", + ":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).", + "", ] for exp, res in zip(expected_result, result): assert exp == res @@ -5040,46 +5040,46 @@ async def test_build_message_no_patch_or_proj_change( result = await notifier.build_message(comparison) expected_result = [ f"## [Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=h1) Report", - f"All modified and coverable lines are covered by tests :white_check_mark:", + "All modified and coverable lines are covered by tests :white_check_mark:", f"> Project coverage is 65.38%. Comparing base [(`{comparison.project_coverage_base.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.project_coverage_base.commit.commitid}?dropdown=coverage&el=desc) to head [(`{comparison.head.commit.commitid[:7]}`)](test.example.br/gh/{repository.slug}/commit/{comparison.head.commit.commitid}?dropdown=coverage&el=desc).", - f"", + "", f"[![Impacted file tree graph](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/graphs/tree.svg?width=650&height=150&src=pr&token={repository.image_token})](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree)", - f"", - f"```diff", - f"@@ Coverage Diff @@", + "", + "```diff", + "@@ Coverage Diff @@", f"## master #{pull.pullid} +/- ##", - f"=======================================", - f" Coverage 65.38% 65.38% ", - f"=======================================", - f" Files 15 15 ", - f" Lines 208 208 ", - f"=======================================", - f" Hits 136 136 ", - f" Misses 4 4 ", - f" Partials 68 68 ", - f"```", - f"", + "=======================================", + " Coverage 65.38% 65.38% ", + "=======================================", + " Files 15 15 ", + " Lines 208 208 ", + "=======================================", + " Hits 136 136 ", + " Misses 4 4 ", + " Partials 68 68 ", + "```", + "", f"| [Flag](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flags) | Coverage Δ | |", - f"|---|---|---|", + "|---|---|---|", f"| [unit](test.example.br/gh/{repository.slug}/pull/{pull.pullid}/flags?src=pr&el=flag) | `25.00% <ø> (ø)` | |", - f"", - f"Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more." - f"", - f"", - f"", - f"------", - f"", + "", + "Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more." + "", + "", + "", + "------", + "", f"[Continue to review full report in " f"Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=continue).", - f"> **Legend** - [Click here to learn " - f"more](https://docs.codecov.io/docs/codecov-delta)", - f"> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", + "> **Legend** - [Click here to learn " + "more](https://docs.codecov.io/docs/codecov-delta)", + "> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`", f"> Powered by " f"[Codecov](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=footer). " f"Last update " f"[{comparison.project_coverage_base.commit.commitid[:7]}...{comparison.head.commit.commitid[:7]}](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?dropdown=coverage&src=pr&el=lastupdated). " f"Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).", - f"", + "", ] for exp, res in zip(expected_result, result): diff --git a/services/notification/notifiers/tests/unit/test_status.py b/services/notification/notifiers/tests/unit/test_status.py index 8ec08a5d5..0f31100da 100644 --- a/services/notification/notifiers/tests/unit/test_status.py +++ b/services/notification/notifiers/tests/unit/test_status.py @@ -1576,7 +1576,7 @@ async def test_notify_adjust_base_behavior_skips_if_target_coverage_defined( current_yaml=UserYaml({}), ) expected_result = { - "message": f"50.00% (target 80.00%)", + "message": "50.00% (target 80.00%)", "state": "failure", } result = await notifier.build_payload(sample_comparison) @@ -2123,7 +2123,7 @@ async def test_build_payload_no_diff_no_base_report( notifier_site_settings=True, current_yaml=UserYaml({}), ) - expected_result = {"message": f"Coverage not affected", "state": "success"} + expected_result = {"message": "Coverage not affected", "state": "success"} result = await notifier.build_payload(comparison) assert expected_result == result @@ -2144,7 +2144,7 @@ async def test_build_payload_without_base_report( current_yaml=UserYaml({}), ) expected_result = { - "message": f"No report found to compare against", + "message": "No report found to compare against", "state": "success", } result = await notifier.build_payload(comparison) diff --git a/services/notification/tests/unit/test_notification_service.py b/services/notification/tests/unit/test_notification_service.py index 2341a468a..c49dedcba 100644 --- a/services/notification/tests/unit/test_notification_service.py +++ b/services/notification/tests/unit/test_notification_service.py @@ -329,7 +329,7 @@ def test_get_notifiers_instances_checks_percentage_whitelist( mocker.patch.dict( os.environ, { - "CHECKS_WHITELISTED_OWNERS": f"0,1", + "CHECKS_WHITELISTED_OWNERS": "0,1", "CHECKS_WHITELISTED_PERCENTAGE": "35", }, ) diff --git a/services/report/__init__.py b/services/report/__init__.py index 09aa2daa8..8e8bc13cb 100644 --- a/services/report/__init__.py +++ b/services/report/__init__.py @@ -639,7 +639,7 @@ async def _do_build_report_from_commit(self, commit) -> Report: return await self.create_new_report_for_commit(commit) @metrics.timer( - f"services.report.ReportService.get_appropriate_commit_to_carryforward_from" + "services.report.ReportService.get_appropriate_commit_to_carryforward_from" ) def get_appropriate_commit_to_carryforward_from( self, commit: Commit, max_parenthood_deepness: int = 10 @@ -754,7 +754,7 @@ async def _possibly_shift_carryforward_report( async def create_new_report_for_commit(self, commit: Commit) -> Report: with metrics.timer( - f"services.report.ReportService.create_new_report_for_commit" + "services.report.ReportService.create_new_report_for_commit" ): log.info( "Creating new report for commit", diff --git a/services/tests/test_bots.py b/services/tests/test_bots.py index 444c39916..bf208fe2b 100644 --- a/services/tests/test_bots.py +++ b/services/tests/test_bots.py @@ -429,9 +429,9 @@ def test_get_owner_installation_id_yes_installation_all_rate_limited( with pytest.raises(NoConfiguredAppsAvailable): get_github_app_info_for_owner(owner, installation_name="my_app") mock_redis.exists.assert_any_call( - f"rate_limited_installations_default_app_123456" + "rate_limited_installations_default_app_123456" ) - mock_redis.exists.assert_any_call(f"rate_limited_installations_1212_12000") + mock_redis.exists.assert_any_call("rate_limited_installations_1212_12000") @pytest.mark.parametrize( "time_edited_days,expected_weight", diff --git a/services/tests/test_urls.py b/services/tests/test_urls.py index 196625ee6..144d1ea16 100644 --- a/services/tests/test_urls.py +++ b/services/tests/test_urls.py @@ -15,8 +15,8 @@ def test_append_tracking_params_to_urls(): org_name = "Acme Corporation" expected_result = [ - f"[This link](https://stage.codecov.io/gh/test_repo/pull/pull123?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation) should be changed", - f"And [this one](https://codecov.io/bb/test_repo/pull?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation) too, plus also [this one](codecov.io?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation)", + "[This link](https://stage.codecov.io/gh/test_repo/pull/pull123?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation) should be changed", + "And [this one](https://codecov.io/bb/test_repo/pull?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation) too, plus also [this one](codecov.io?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation)", "However, [this one](https://www.xkcd.com/) should not be changed since it does not link to Codecov", "(Also should not replace this parenthetical non-link reference to codecov.io)", "Also should recognize that these are two separate URLs: [banana](https://codecov.io/pokemon?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation)and[banana](https://codecov.io/pokemon?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Acme+Corporation)", diff --git a/tasks/send_email.py b/tasks/send_email.py index e08077180..9990b35cf 100644 --- a/tasks/send_email.py +++ b/tasks/send_email.py @@ -68,7 +68,7 @@ def run_impl( email_wrapper = Email(to_addr, from_addr, subject, text, html) err_msg = None - metrics.incr(f"worker.tasks.send_email.attempt") + metrics.incr("worker.tasks.send_email.attempt") with metrics.timer("worker.tasks.send_email.send"): try: smtp_service.send(email_wrapper) @@ -77,11 +77,11 @@ def run_impl( if err_msg is not None: log.warning(f"Failed to send email: {err_msg}", extra=log_extra_dict) - metrics.incr(f"worker.tasks.send_email.fail") + metrics.incr("worker.tasks.send_email.fail") return {"email_successful": False, "err_msg": err_msg} log.info("Sent email", extra=log_extra_dict) - metrics.incr(f"worker.tasks.send_email.succeed") + metrics.incr("worker.tasks.send_email.succeed") return {"email_successful": True, "err_msg": None} diff --git a/tasks/tests/integration/test_notify_task.py b/tasks/tests/integration/test_notify_task.py index cba066e6f..33cda2961 100644 --- a/tasks/tests/integration/test_notify_task.py +++ b/tasks/tests/integration/test_notify_task.py @@ -1003,7 +1003,7 @@ def test_simple_call_status_and_notifiers( notification_successful=True, explanation=None, data_sent={ - "text": f"Coverage for *no change* `` on `test` is `85.00000%` via ``", + "text": "Coverage for *no change* `` on `test` is `85.00000%` via ``", "author_name": "Codecov", "author_link": "https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/commit/5601846871b8142ab0df1e0b8774756c658bcc7d", "attachments": [], @@ -1164,7 +1164,7 @@ def test_simple_call_status_and_notifiers( "message": [ "## [Codecov](https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/pull/9?dropdown=coverage&src=pr&el=h1) Report", "All modified and coverable lines are covered by tests :white_check_mark:", - f"> Project coverage is 85.00%. Comparing base [(`5b174c2`)](https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/commit/5b174c2b40d501a70c479e91025d5109b1ad5c1b?dropdown=coverage&el=desc) to head [(`5601846`)](https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/commit/5601846871b8142ab0df1e0b8774756c658bcc7d?dropdown=coverage&el=desc).", + "> Project coverage is 85.00%. Comparing base [(`5b174c2`)](https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/commit/5b174c2b40d501a70c479e91025d5109b1ad5c1b?dropdown=coverage&el=desc) to head [(`5601846`)](https://myexamplewebsite.io/gh/joseph-sentry/codecov-demo/commit/5601846871b8142ab0df1e0b8774756c658bcc7d?dropdown=coverage&el=desc).", "> Report is 2 commits behind head on main.", "", ":exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.", diff --git a/tasks/tests/unit/test_backfill_commit_data_to_storage_task.py b/tasks/tests/unit/test_backfill_commit_data_to_storage_task.py index af32429f5..b96e2c91a 100644 --- a/tasks/tests/unit/test_backfill_commit_data_to_storage_task.py +++ b/tasks/tests/unit/test_backfill_commit_data_to_storage_task.py @@ -68,7 +68,7 @@ def test_all_report_rows(self, mock_handle_single_row, dbsession): def mock_handle_single_row_return_side_effect(db_session, commit, report_row): if report_row.code is None: return {"success": True, "errors": []} - if report_row.code is "local": + if report_row.code == "local": return {"success": False, "errors": [BackfillError.missing_data.value]} mock_handle_single_row.side_effect = mock_handle_single_row_return_side_effect diff --git a/tasks/tests/unit/test_backfill_existing_gh_app_installations.py b/tasks/tests/unit/test_backfill_existing_gh_app_installations.py index be8657c95..6f3040f0c 100644 --- a/tasks/tests/unit/test_backfill_existing_gh_app_installations.py +++ b/tasks/tests/unit/test_backfill_existing_gh_app_installations.py @@ -47,7 +47,7 @@ def test_gh_app_with_selection_all( "repository_selection": "all" } mocker.patch( - f"tasks.backfill_existing_gh_app_installations.get_owner_provider_service", + "tasks.backfill_existing_gh_app_installations.get_owner_provider_service", return_value=mock_repo_provider, ) @@ -96,7 +96,7 @@ def test_gh_app_with_specific_owner_ids( "repository_selection": "all" } mocker.patch( - f"tasks.backfill_existing_gh_app_installations.get_owner_provider_service", + "tasks.backfill_existing_gh_app_installations.get_owner_provider_service", return_value=mock_repo_provider, ) diff --git a/tasks/tests/unit/test_bundle_analysis_processor_task.py b/tasks/tests/unit/test_bundle_analysis_processor_task.py index f1f7775a5..3c738690a 100644 --- a/tasks/tests/unit/test_bundle_analysis_processor_task.py +++ b/tasks/tests/unit/test_bundle_analysis_processor_task.py @@ -10,7 +10,7 @@ from tasks.bundle_analysis_processor import BundleAnalysisProcessorTask -def test_bundle_analysis_processor_task( +def test_bundle_analysis_processor_task_success( mocker, mock_configuration, dbsession, @@ -19,7 +19,7 @@ def test_bundle_analysis_processor_task( celery_app, ): storage_path = ( - f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" ) mock_storage.write_file(get_bucket_name(), storage_path, "test-content") @@ -75,7 +75,7 @@ def test_bundle_analysis_processor_task_error( celery_app, ): storage_path = ( - f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" ) mock_storage.write_file(get_bucket_name(), storage_path, "test-content") @@ -191,7 +191,7 @@ def test_bundle_analysis_process_upload_general_error( celery_app, ): storage_path = ( - f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" ) mock_storage.write_file(get_bucket_name(), storage_path, "test-content") @@ -258,7 +258,7 @@ def test_bundle_analysis_processor_task_locked( celery_app, ): storage_path = ( - f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" ) mock_storage.write_file(get_bucket_name(), storage_path, "test-content") @@ -310,7 +310,7 @@ def test_bundle_analysis_process_upload_rate_limit_error( celery_app, ): storage_path = ( - f"v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" ) mock_storage.write_file(get_bucket_name(), storage_path, "test-content") @@ -364,3 +364,288 @@ def test_bundle_analysis_process_upload_rate_limit_error( assert commit.state == "error" assert upload.state == "error" retry.assert_called_once_with(countdown=20, max_retries=5) + + +def test_bundle_analysis_process_associate_no_parent_commit_id( + mocker, + mock_configuration, + dbsession, + mock_storage, + mock_redis, + celery_app, +): + storage_path = ( + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + ) + mock_storage.write_file(get_bucket_name(), storage_path, "test-content") + + mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app) + + parent_commit = CommitFactory.create(state="completed") + dbsession.add(parent_commit) + dbsession.flush() + + commit = CommitFactory.create(state="pending", parent_commit_id=None) + dbsession.add(commit) + dbsession.flush() + + commit_report = CommitReport(commit_id=commit.id_) + dbsession.add(commit_report) + dbsession.flush() + + upload = UploadFactory.create(storage_path=storage_path, report=commit_report) + dbsession.add(upload) + dbsession.flush() + + ingest = mocker.patch("shared.bundle_analysis.BundleAnalysisReport.ingest") + ingest.return_value = 123 # session_id + + BundleAnalysisProcessorTask().run_impl( + dbsession, + {"results": [{"previous": "result"}]}, + repoid=commit.repoid, + commitid=commit.commitid, + commit_yaml={}, + params={ + "upload_pk": upload.id_, + "commit": commit.commitid, + }, + ) + + assert commit.state == "complete" + assert upload.state == "processed" + + +def test_bundle_analysis_process_associate_no_parent_commit_object( + mocker, + mock_configuration, + dbsession, + mock_storage, + mock_redis, + celery_app, +): + storage_path = ( + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + ) + mock_storage.write_file(get_bucket_name(), storage_path, "test-content") + + mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app) + + parent_commit = CommitFactory.create(state="completed") + + commit = CommitFactory.create( + state="pending", parent_commit_id=parent_commit.commitid + ) + dbsession.add(commit) + dbsession.flush() + + commit_report = CommitReport(commit_id=commit.id_) + dbsession.add(commit_report) + dbsession.flush() + + upload = UploadFactory.create(storage_path=storage_path, report=commit_report) + dbsession.add(upload) + dbsession.flush() + + ingest = mocker.patch("shared.bundle_analysis.BundleAnalysisReport.ingest") + ingest.return_value = 123 # session_id + + BundleAnalysisProcessorTask().run_impl( + dbsession, + {"results": [{"previous": "result"}]}, + repoid=commit.repoid, + commitid=commit.commitid, + commit_yaml={}, + params={ + "upload_pk": upload.id_, + "commit": commit.commitid, + }, + ) + + assert commit.state == "complete" + assert upload.state == "processed" + + +def test_bundle_analysis_process_associate_no_parent_commit_report_object( + mocker, + mock_configuration, + dbsession, + mock_storage, + mock_redis, + celery_app, +): + storage_path = ( + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + ) + mock_storage.write_file(get_bucket_name(), storage_path, "test-content") + + mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app) + + parent_commit = CommitFactory.create(state="completed") + dbsession.add(parent_commit) + dbsession.flush() + + commit = CommitFactory.create( + state="pending", + parent_commit_id=parent_commit.commitid, + repository=parent_commit.repository, + ) + dbsession.add(commit) + dbsession.flush() + + commit_report = CommitReport(commit_id=commit.id_) + dbsession.add(commit_report) + dbsession.flush() + + upload = UploadFactory.create(storage_path=storage_path, report=commit_report) + dbsession.add(upload) + dbsession.flush() + + ingest = mocker.patch("shared.bundle_analysis.BundleAnalysisReport.ingest") + ingest.return_value = 123 # session_id + + BundleAnalysisProcessorTask().run_impl( + dbsession, + {"results": [{"previous": "result"}]}, + repoid=commit.repoid, + commitid=commit.commitid, + commit_yaml={}, + params={ + "upload_pk": upload.id_, + "commit": commit.commitid, + }, + ) + + assert commit.state == "complete" + assert upload.state == "processed" + + +def test_bundle_analysis_process_associate_called( + mocker, + mock_configuration, + dbsession, + mock_storage, + mock_redis, + celery_app, +): + storage_path = ( + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + ) + mock_storage.write_file(get_bucket_name(), storage_path, "test-content") + + mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app) + + parent_commit = CommitFactory.create(state="completed") + dbsession.add(parent_commit) + dbsession.flush() + + parent_commit_report = CommitReport( + commit_id=parent_commit.id_, report_type="bundle_analysis" + ) + dbsession.add(parent_commit_report) + dbsession.flush() + + commit = CommitFactory.create( + state="pending", + parent_commit_id=parent_commit.commitid, + repository=parent_commit.repository, + ) + dbsession.add(commit) + dbsession.flush() + + commit_report = CommitReport(commit_id=commit.id_) + dbsession.add(commit_report) + dbsession.flush() + + upload = UploadFactory.create(storage_path=storage_path, report=commit_report) + dbsession.add(upload) + dbsession.flush() + + ingest = mocker.patch("shared.bundle_analysis.BundleAnalysisReport.ingest") + ingest.return_value = 123 # session_id + + BundleAnalysisProcessorTask().run_impl( + dbsession, + {"results": [{"previous": "result"}]}, + repoid=commit.repoid, + commitid=commit.commitid, + commit_yaml={}, + params={ + "upload_pk": upload.id_, + "commit": commit.commitid, + }, + ) + + assert commit.state == "complete" + assert upload.state == "processed" + + +def test_bundle_analysis_process_associate_called_two( + mocker, + mock_configuration, + dbsession, + mock_storage, + mock_redis, + celery_app, +): + storage_path = ( + "v1/repos/testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite" + ) + mock_storage.write_file(get_bucket_name(), storage_path, "test-content") + + mocker.patch.object(BundleAnalysisProcessorTask, "app", celery_app) + + parent_commit = CommitFactory.create(state="completed") + dbsession.add(parent_commit) + dbsession.flush() + + parent_commit_report = CommitReport( + commit_id=parent_commit.id_, report_type="bundle_analysis" + ) + dbsession.add(parent_commit_report) + dbsession.flush() + + commit = CommitFactory.create( + state="pending", + parent_commit_id=parent_commit.commitid, + repository=parent_commit.repository, + ) + dbsession.add(commit) + dbsession.flush() + + commit_report = CommitReport(commit_id=commit.id_) + dbsession.add(commit_report) + dbsession.flush() + + upload = UploadFactory.create(storage_path=storage_path, report=commit_report) + dbsession.add(upload) + dbsession.flush() + + ingest = mocker.patch("shared.bundle_analysis.BundleAnalysisReport.ingest") + ingest.return_value = 123 # session_id + + associate = mocker.patch( + "shared.bundle_analysis.BundleAnalysisReport.associate_previous_assets" + ) + associate.return_value = None + + prev_bundle_report = mocker.patch( + "services.bundle_analysis.BundleAnalysisReportService._previous_bundle_analysis_report" + ) + prev_bundle_report.return_value = True + + BundleAnalysisProcessorTask().run_impl( + dbsession, + {"results": [{"previous": "result"}]}, + repoid=commit.repoid, + commitid=commit.commitid, + commit_yaml={}, + params={ + "upload_pk": upload.id_, + "commit": commit.commitid, + }, + ) + + assert commit.state == "complete" + assert upload.state == "processed" + associate.assert_called_once() diff --git a/tasks/tests/unit/test_clean_labels_index.py b/tasks/tests/unit/test_clean_labels_index.py index fba983159..8c029484b 100644 --- a/tasks/tests/unit/test_clean_labels_index.py +++ b/tasks/tests/unit/test_clean_labels_index.py @@ -111,7 +111,7 @@ class TestCleanLabelsIndexSyncronization(object): def test__is_currently_processing( self, mock_redis, commitid, is_currently_processing ): - mock_redis.keys = {f"upload_processing_lock_1_sha_1": True} + mock_redis.keys = {"upload_processing_lock_1_sha_1": True} lock_name = UPLOAD_PROCESSING_LOCK_NAME(1, commitid) task = CleanLabelsIndexTask() assert ( diff --git a/tasks/tests/unit/test_test_results_finisher.py b/tasks/tests/unit/test_test_results_finisher.py index 374cfccfc..be6bad5b5 100644 --- a/tasks/tests/unit/test_test_results_finisher.py +++ b/tasks/tests/unit/test_test_results_finisher.py @@ -337,7 +337,7 @@ def test_upload_finisher_task_call( assert expected_result == result mock_repo_provider_comments.post_comment.assert_called_with( pull.pullid, - f"**Test Failures Detected**: Due to failing tests, we cannot provide coverage reports at this time.\n\n### :x: Failed Test Results: \nCompleted 4 tests with **`4 failed`**, 0 passed and 0 skipped.\n
View the full list of failed tests\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name0

**Envs:**
- 0
|
<pre>Fourth 

</pre> | test | instance |
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name1

**Envs:**
- 1
|
Shared failure message
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name2

**Envs:**
- default
|
Shared failure message
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name3

**Envs:**
- 0
|
No failure message available
|", + "**Test Failures Detected**: Due to failing tests, we cannot provide coverage reports at this time.\n\n### :x: Failed Test Results: \nCompleted 4 tests with **`4 failed`**, 0 passed and 0 skipped.\n
View the full list of failed tests\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name0

**Envs:**
- 0
|
<pre>Fourth 

</pre> | test | instance |
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name1

**Envs:**
- 1
|
Shared failure message
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name2

**Envs:**
- default
|
Shared failure message
|\n|
**Testsuite:**
test_testsuite

**Test name:**
test_name3

**Envs:**
- 0
|
No failure message available
|", ) mock_metrics.incr.assert_has_calls( diff --git a/tasks/upload.py b/tasks/upload.py index 50828dad3..5db7fd854 100644 --- a/tasks/upload.py +++ b/tasks/upload.py @@ -409,7 +409,7 @@ def run_impl_within_lock( checkpoints.log(UploadFlow.PROCESSING_BEGIN) except ValueError as e: log.warning( - f"CheckpointLogger failed to log/submit", extra=dict(error=e) + "CheckpointLogger failed to log/submit", extra=dict(error=e) ) commit = None diff --git a/tasks/upload_finisher.py b/tasks/upload_finisher.py index 032f2bc6a..d133657e5 100644 --- a/tasks/upload_finisher.py +++ b/tasks/upload_finisher.py @@ -70,7 +70,7 @@ def run_impl( checkpoints = checkpoints_from_kwargs(UploadFlow, kwargs) checkpoints.log(UploadFlow.BATCH_PROCESSING_COMPLETE) except ValueError as e: - log.warning(f"CheckpointLogger failed to log/submit", extra=dict(error=e)) + log.warning("CheckpointLogger failed to log/submit", extra=dict(error=e)) log.info( "Received upload_finisher task",