-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Remove duplicate names for resolvers and tests #527
Conversation
@@ -333,24 +333,6 @@ def test_tree_not_found_for_components( | |||
res = self._tree(components="Does_not_exist") | |||
assert res.status_code == 404 | |||
|
|||
@patch("shared.reports.api_report_service.build_report_from_commit") | |||
@patch("services.components.commit_components") | |||
def test_tree_not_found_for_components( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looked to be an exact copy of the one above it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
@@ -56,7 +56,7 @@ def test_save_terms_agreement_delegate_to_interactor(self, interactor_mock): | |||
interactor_mock.assert_called_once_with(input_dict) | |||
|
|||
@patch("codecov_auth.commands.owner.owner.StartTrialInteractor.execute") | |||
def test_cancel_trial_delegate_to_interactor(self, interactor_mock): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all the resolvers, I just named them what the property was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes weren't necessary though; just a cleanliness thing
@@ -628,36 +628,7 @@ def test_fetch_path_contents_unknown_path( | |||
} | |||
|
|||
@patch("services.report.build_report_from_commit") | |||
def test_fetch_path_contents_unknown_flags(self, report_mock): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looked to be a duplicate of the below test that was never updated
@@ -979,68 +979,6 @@ def test_pull_comparison_no_comparison(self, compute_comparisons_mock): | |||
|
|||
compute_comparisons_mock.assert_called_once | |||
|
|||
def test_pull_comparison_missing_head_report(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the following test are using deprecated patterns
expected_response = {"vcs_revision": "c739768fcac68144a3a6d82305b9c4106934d31a"} | ||
expected_response = { | ||
"vcs_revision": "c739768fcac68144a3a6d82305b9c4106934d31a", | ||
"stop_time": "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test was missing stop_time
@@ -153,9 +153,9 @@ def test_head_report(self, base_report_mock): | |||
} | |||
) | |||
component_comparison = ComponentComparison(self.comparison, component_go) | |||
assert component_comparison.head_report.files == ["file_1.go"] | |||
assert component_comparison.base_report.files == ["file_1.go"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test wasn't actually looking at base_report
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found Additional details and impacted files@@ Coverage Diff @@
## main #527 +/- ##
==========================================
+ Coverage 91.48% 91.50% +0.01%
==========================================
Files 599 599
Lines 16271 16271
==========================================
+ Hits 14885 14888 +3
+ Misses 1386 1383 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found @@ Coverage Diff @@
## main #527 +/- ##
==========================================
+ Coverage 91.48% 91.50% +0.01%
==========================================
Files 599 599
Lines 16271 16271
==========================================
+ Hits 14885 14888 +3
+ Misses 1386 1383 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Changes have been made to critical files, which contain lines commonly executed in production. Learn more ✅ All tests successful. No failed tests found Additional details and impacted files@@ Coverage Diff @@
## main #527 +/- ##
=======================================
+ Coverage 95.78 95.80 +0.02
=======================================
Files 774 774
Lines 17127 17127
=======================================
+ Hits 16404 16407 +3
+ Misses 723 720 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the linter issue you raised in the description of this pr - it's standard to have one, we should have one.
@@ -333,24 +333,6 @@ def test_tree_not_found_for_components( | |||
res = self._tree(components="Does_not_exist") | |||
assert res.status_code == 404 | |||
|
|||
@patch("shared.reports.api_report_service.build_report_from_commit") | |||
@patch("services.components.commit_components") | |||
def test_tree_not_found_for_components( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
Purpose/Motivation
When investigating another ticket, I saw that in our repo we sometimes used the same function name for multiple resolvers. This seemed like a clear code error, but then I realized that the resolver "bindable_field" decorator was added to things to maintain that uniqueness.
However, one place this wasn't accounted for was in tests. And I found some surprising results post fixing the duplicate test names. That the tests with duplicate names were not running. This seemed pretty concerning, since after fixing all the duplicate test names I saw there were 8 failing tests; ranging from a few months to a few years old.
This also made me realize that we don't have a linter on API (or worker / shared if I was looking at the code correctly), and might be something we want to look into adding sooner rather than later.
Anyway, this PR aims to fix all the duplicate function name errors in API, though I may need a bit of help with the remaining failing tests to see if they're still needed or not. My thinking is 3 of the 5 aren't needed anymore? In test_branch.py, and test_pull_comparison.py
Screenshots
AFTER Removing the duplicate function names
BEFORE
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.