-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
CLN/DOC: fix test_register_entrypoint #46302
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
CLN/DOC: fix test_register_entrypoint #46302
Conversation
| def test_setting_backend_without_plot_raises(monkeypatch): | ||
| # GH-28163 | ||
| module = types.ModuleType("pandas_plot_backend") | ||
| sys.modules["pandas_plot_backend"] = module |
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.
pandas_plot_backend in sys.modules was leaked into other tests
| @td.skip_if_no_mpl | ||
| def test_register_entrypoint(restore_backend): | ||
|
|
||
| dist = pkg_resources.get_distribution("pandas") |
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.
this test was invalid because the underlying code uses importlib.metadata and not pkg_resources - so the pkg_resources.get_entry_map monkeypatch was unused.
however it passed because the entrypoint name matched the module name and so the code fell back to a regular import
881d1eb to
29e07aa
Compare
| warmup_time = 0 | ||
|
|
||
| def setup(self): | ||
| dist = pkg_resources.get_distribution("pandas") |
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.
this test was invalid because the underlying code uses importlib.metadata and not pkg_resources - so this pkg_resources.get_entry_map monkeypatch was unused.
It only passed because _get_plot_backend falls back to importlib.import_module
by cleaning up all outdated references to pkg_resources
29e07aa to
80715e4
Compare
|
thanks @graingert very nice |
and cleanup tests eg #27517
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.