Skip to content
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 unreleated unresolved symbols (PP-1161) #1808

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

jonathangreen
Copy link
Member

Description

While testing #1802 I used the pycharm analysis to look through our code for unresolved symbols. I was trying to find any imports I had broken. I didn't find any broken imports, but I did find a number of issues that this PR resolves.

Motivation and Context

Testing for PP-1161

How Has This Been Tested?

Running tests in CI.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen requested a review from a team April 26, 2024 15:18
Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.01%. Comparing base (b1ab61a) to head (6b7b6a8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
+ Coverage   90.00%   90.01%   +0.01%     
==========================================
  Files         298      298              
  Lines       39642    39638       -4     
  Branches     8597     8596       -1     
==========================================
+ Hits        35680    35682       +2     
+ Misses       2630     2625       -5     
+ Partials     1332     1331       -1     
Flag Coverage Δ
manager 89.82% <100.00%> (+0.01%) ⬆️
migration 24.59% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

from palace.manager.core.monitor import CustomListEntryLicensePoolUpdateMonitor
from palace.manager.core.scripts import RunMonitorScript

RunMonitorScript(CustomListEntryLicensePoolUpdateMonitor).run()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CustomListEntryLicensePoolUpdateMonitor doesn't exist, and looks at git history hasn't for a long time (maybe not ever?). So remove the script.

@@ -13,7 +13,6 @@
import logging
import re
from collections import Counter
from importlib.resources import files
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import.


if self.primary_identifier in self.recommendations:
self.recommendations.remove(identifier_data)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identifier_data here was unresolved. This hasn't happened enough to have gotten to the top errors we see in prod, so it must not happen very often, but good to fix it.

I updated this to be a little safer as well. Since the identifiers could overlap, we put them into a set, combine them, and then remove the primary identifier if needed. Finally convert to list and update self.recommendations.

@@ -143,14 +143,6 @@ def is_corporate_name(display_name):
return False


def is_one_name(human_name):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

human_name 👽 was unresolved here. The function isn't used, so just remove it.

@@ -249,25 +244,3 @@ def test__is_url(self):
# You can make specific URLs go through even if they
# wouldn't normally pass.
assert True == m("Not a URL", ["Not a URL", "Also not a URL"])


class PatronAuthenticationValidatorFactoryTest:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test class was never called because of its name: PatronAuthenticationValidatorFactoryTest rather then TestPatronAuthenticationValidatorFactory.

PatronAuthenticationValidatorFactory here is undefined and has long been removed, so remove this old test. It was also the only thing referencing the dummy_validator functions, so 🔥 those as well.

primary_identifier,
]
metadata.filter_recommendations(db.session)
assert [known_identifier] == metadata.recommendations
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add another test case here, so that we actually exercise the if statement that was broken in filter_recommendations.

@jonathangreen jonathangreen force-pushed the feature/put-into-package branch from b1d07ad to d30fc4c Compare April 26, 2024 15:36
Base automatically changed from feature/put-into-package to main April 26, 2024 19:02
Copy link
Contributor

@dbernstein dbernstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM

@jonathangreen jonathangreen added the bug Something isn't working label Apr 26, 2024
@jonathangreen jonathangreen force-pushed the bugfix/unresolved-symbols branch from 445b20c to 6b7b6a8 Compare April 26, 2024 21:11
@jonathangreen jonathangreen merged commit 74c483f into main Apr 26, 2024
21 checks passed
@jonathangreen jonathangreen deleted the bugfix/unresolved-symbols branch April 26, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants