fix(core): support entry points provider in get_notifier and add related test #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request makes a small but important fix to how notifier providers are retrieved and adds a new test to ensure correct behavior when using entry points.
Provider retrieval fix:
get_notifierfunction innotifiers/core.pyto use the dynamically fetchedprovidersdictionary instead of a potentially stale global variable, ensuring the correct provider instance is returned.Testing improvements:
test_get_notifier_entry_pointsintests/test_core.pyto verify thatget_notifiercorrectly uses entry points for provider discovery, improving test coverage for dynamic provider loading.- Fix get_notifier logic to ensure providers from entry points are correctly retrieved.Why change _all_providersprovider_name to providersprovider_name?
Previously, get_notifier only looked up providers from the static _all_providers dictionary, which contains built-in providers. This approach did not support providers registered dynamically via Python entry points (i.e., plugin providers).
By switching to providersprovider_name, where providers is the result of get_all_providers(), we ensure that both built-in and entry point (plugin) providers are included in the lookup. This makes the function extensible and compatible with third-party or dynamically registered providers, improving the flexibility and plugin support of the library.