-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add list plugins method and tests #2496
base: main
Are you sure you want to change the base?
Conversation
22e7a92
to
c632393
Compare
@CyclingNinja - could you try rebasing on upstream/main to get rid of the merge commit? |
""" | ||
load_plugins(require_qt_plugins=False) | ||
plugins = list_plugins() | ||
assert isinstance(plugins, list) |
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.
Maybe you can check that certain plugins are in the list
glue/main.py
Outdated
@@ -115,3 +114,10 @@ def load_plugins(splash=None, require_qt_plugins=False, plugins_to_load=None): | |||
# that were previously read. | |||
from glue._settings_helpers import load_settings | |||
load_settings() | |||
|
|||
|
|||
def list_plugins(): |
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.
Thinking about this, I think we might want to actually have list_available_plugins
and list_loaded_plugins
as there are use cases for both. Could you implement both here?
cc44b8e
to
fe34214
Compare
glue/tests/test_main.py
Outdated
load_plugins(require_qt_plugins=False) | ||
plugins = list_plugins() | ||
assert isinstance(plugins, list) | ||
assert len(plugins) == 5 |
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.
Sorry I didn't get back to you sooner about this - rather than checking the absolute number of plugins, you might want to just check that a specific set of them are inside the returned list (but there could be others present)
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.
The above comment still stands, can you check one of the plugins in the list?
0e397fa
to
6404d9d
Compare
glue/main.py
Outdated
@@ -3,7 +3,7 @@ | |||
from importlib import import_module | |||
|
|||
from glue.logger import logger | |||
from glue._plugin_helpers import REQUIRED_PLUGINS, REQUIRED_PLUGINS_QT | |||
from glue._plugin_helpers import REQUIRED_PLUGINS |
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 change and the one below should be reverted here
return sorted(_loaded_plugins) | ||
|
||
|
||
def list_available_plugins(): |
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.
Could you import these two functions into the top-level of the package? See:
Line 22 in 5e92185
from .main import load_plugins # noqa |
glue/tests/test_main.py
Outdated
|
||
def test_list_loaded_plugins(): | ||
""" | ||
Regression test for retrieving the list of currently loaded plugins |
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.
Change 'regression' to 'unit'
glue/tests/test_main.py
Outdated
load_plugins(require_qt_plugins=False) | ||
plugins = list_plugins() | ||
assert isinstance(plugins, list) | ||
assert len(plugins) == 5 |
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.
The above comment still stands, can you check one of the plugins in the list?
glue/tests/test_main.py
Outdated
available_plugins = list_available_plugins() | ||
assert isinstance(available_plugins, list) | ||
assert len(available_plugins) == 7 | ||
assert 'casa_formats_io.glue_factory' in available_plugins |
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.
I'd remove this one, it is only available if glue-astronomy is installed. For checking the absolute number above, maybe first filter it down to just the ones starting with 'glue.' and then you can check how many there are (as otherwise the test will fail if plugin packages are installed)
55a335e
to
450e6fd
Compare
450e6fd
to
6169782
Compare
bd6fd92
to
20787f2
Compare
No description provided.