Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyleeow committed Nov 23, 2023
1 parent 50ad178 commit 49be7db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/npe2/_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def _dispose(self):
try:
self._disposables.pop()()
except Exception as e:
logger.warn(f"Error while disposing {self.plugin_key}; {e}")
logger.warning(f"Error while disposing {self.plugin_key}; {e}")

def register_command(self, id: str, command: Optional[Callable] = None):
"""Associate a callable with a command id."""
Expand Down
9 changes: 4 additions & 5 deletions tests/test_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def test_plugin_context_dispose():
mock.assert_called_once()


def test_plugin_context_dispose_error():
"""Test"""
def test_plugin_context_dispose_error(caplog):
"""Test errors when executing dispose functions caught correctly."""
pm = PluginManager()
mf = PluginManifest(name="test")
pm.register(mf)
Expand All @@ -234,6 +234,5 @@ def dummy_error():
raise ValueError("This is an error")

pm.get_context("test").register_disposable(dummy_error)
msg = "Error while disposing test; This is an error"
with pytest.raises(ValueError, match=msg):
pm.deactivate("test")
pm.deactivate("test")
assert caplog.records[0].msg == "Error while disposing test; This is an error"

0 comments on commit 49be7db

Please sign in to comment.