Skip to content
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

Don't add Python Plugins to Manager Twice #1064

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

JeffersGlass
Copy link
Member

Python plugins were being registered with the App's plugin manager twice: once in fetchPythonPlugins:

if (typeof module.plugin !== 'undefined') {
const py_plugin = module.plugin;
py_plugin.init(this);
this.plugins.addPythonPlugin(py_plugin);

And once in the init method of the Python Plugin class itself:

def init(self, app):
self.app = app
self.app.plugins.addPythonPlugin(create_proxy(self))

This PR removes the second registration, and improves test_execution_hooks to check that the specified hooks are called exactly once, instead of at least once.

Fixes #1049

@JeffersGlass JeffersGlass added the tag: plugins Related to the infrastructure of how plugins work, or to specific plugins. label Dec 21, 2022
@JeffersGlass JeffersGlass self-assigned this Dec 21, 2022
Copy link
Contributor

@FabioRosado FabioRosado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you for fixing this 😄

@JeffersGlass JeffersGlass merged commit 059dbc8 into pyscript:main Dec 21, 2022
@JeffersGlass JeffersGlass deleted the plugin-double-calls branch December 21, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: plugins Related to the infrastructure of how plugins work, or to specific plugins.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python Plugin Methods are Executed Twice
2 participants