-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Re-raise ModuleNotFoundError unless for guessed task #8660
Re-raise ModuleNotFoundError unless for guessed task #8660
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8660 +/- ##
=======================================
Coverage 87.34% 87.34%
=======================================
Files 148 148
Lines 18519 18519
Branches 3164 3164
=======================================
Hits 16176 16176
Misses 2059 2059
Partials 284 284
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.
except the unit test the Int tests seems good
@@ -271,7 +271,7 @@ def find_related_module(package, related_name): | |||
except ModuleNotFoundError as e: | |||
import_exc_name = getattr(e, 'name', None) | |||
# If candidate does not exist, then return None. | |||
if import_exc_name and module_name.startswith(import_exc_name): | |||
if import_exc_name and module_name == import_exc_name: |
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.
should we adjust the unit tests as well? with this new change?
Description
We just merged #8632, which should propagate import-errors that originate outside of the
importlib.import_module
call. After reading through the code again today, I realized my change may swallow some other import errors that should fail.I've updated the integration test with clearer cases, and modified
celery.loaders.base.find_related_module
so that it only returns none if the exact task-module being guessed is what caused theModuleNotFoundError
.