Skip to content

Conversation

@ShawnDen-coder
Copy link

@ShawnDen-coder ShawnDen-coder commented Oct 28, 2025

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:

  • Updated the get_notifier function in notifiers/core.py to use the dynamically fetched providers dictionary instead of a potentially stale global variable, ensuring the correct provider instance is returned.

Testing improvements:

  • Added a new test test_get_notifier_entry_points in tests/test_core.py to verify that get_notifier correctly 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.
  • Add test_get_notifier_entry_points to mock and verify entry points provider support.

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.

…ted test

- Fix get_notifier logic to ensure providers from entry points are correctly retrieved.
- Add test_get_notifier_entry_points to mock and verify entry points provider support.
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.

1 participant