From 059dbc88c97dc1db766274d96a6a0d8f7d373439 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Wed, 21 Dec 2022 12:10:01 -0600 Subject: [PATCH] Don't add plugin to manager twice (#1064) * Prevent Python plugins from being added to PluginManager twice --- pyscriptjs/src/python/pyscript.py | 1 - pyscriptjs/tests/integration/test_plugins.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyscriptjs/src/python/pyscript.py b/pyscriptjs/src/python/pyscript.py index 5270e0b65df..4aa3b2fa458 100644 --- a/pyscriptjs/src/python/pyscript.py +++ b/pyscriptjs/src/python/pyscript.py @@ -497,7 +497,6 @@ def __init__(self, name=None): def init(self, app): self.app = app - self.app.plugins.addPythonPlugin(create_proxy(self)) def register_custom_element(self, tag): # TODO: Ideally would be better to use the logger. diff --git a/pyscriptjs/tests/integration/test_plugins.py b/pyscriptjs/tests/integration/test_plugins.py index 04ed6eeb30f..3299ca2d49b 100644 --- a/pyscriptjs/tests/integration/test_plugins.py +++ b/pyscriptjs/tests/integration/test_plugins.py @@ -164,7 +164,7 @@ def test_execution_hooks(self): # EXPECT it to log the correct logs for the events it intercepts log_lines = self.console.log.lines for method in hooks_available: - assert f"{method} called" in log_lines + assert log_lines.count(f"{method} called") == 1 # EXPECT it to NOT be called (hence not log anything) the events that happen # before it's ready, hence is not called