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 get_plugins() bug #1723

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

BryceGattis
Copy link
Contributor

Add suggested fix from @mmdanggg2 and add tests.

Closes #1618.

Signed-off-by: Bryce Gattis <brycegattis@yahoo.com>
@BryceGattis BryceGattis requested a review from a team as a code owner April 15, 2024 02:52
Signed-off-by: Bryce Gattis <brycegattis@yahoo.com>
Signed-off-by: Bryce Gattis <brycegattis@yahoo.com>
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.43%. Comparing base (36e0537) to head (7b5b913).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1723      +/-   ##
==========================================
+ Coverage   58.29%   58.43%   +0.14%     
==========================================
  Files         126      126              
  Lines       17159    17160       +1     
  Branches     3505     3505              
==========================================
+ Hits        10002    10028      +26     
+ Misses       6493     6465      -28     
- Partials      664      667       +3     

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

Signed-off-by: Bryce Gattis <brycegattis@yahoo.com>
Signed-off-by: Bryce Gattis <brycegattis@yahoo.com>
@@ -152,7 +153,7 @@ def get_plugins(package_name, paths=None):
continue # not a plugin of itself

plugin_pkg = get_latest_package(package_name_, paths=paths)
if not plugin_pkg.plugin_for:
if not plugin_pkg or not plugin_pkg.plugin_for:

Choose a reason for hiding this comment

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

I'm wondering if we should instead make sure that get_latest_package returns valid packages. The docstring of get_latest_package says that it should either return a Package object or None is a package is not found. There is also this TODO

rez/src/rez/packages.py

Lines 925 to 926 in 71d990b

# FIXME this isn't correct, since the pkg fam may exist but a pkg
# in the range does not.

It my books, that's what I call smell.

Choose a reason for hiding this comment

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

In the case of #1618 I would say that get_latest_package is correctly returning None, as there is no valid package in an empty folder. Perhaps then iter_package_families should be more thorough and not return package names if there is no valid package in the folders?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error searching for plugins if there is an empty package folder in the repo
3 participants