Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions envisage/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from fnmatch import fnmatch
import logging
import warnings

from traits.api import Event, HasTraits, Instance, List, observe, provides, Str

Expand Down Expand Up @@ -82,6 +83,14 @@ def __init__(self, plugins=None, **traits):
plugins use 'for plugin in plugin_manager'.

"""
if "include" in traits or "exclude" in traits:
warnings.warn(
"The 'include' and 'exclude' traits to PluginManager "
"are deprecated, and will be removed in a future version "
"of Envisage",
DeprecationWarning,
stacklevel=2,
)

super().__init__(**traits)

Expand Down
68 changes: 36 additions & 32 deletions envisage/tests/test_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ def test_only_include_plugins_whose_ids_are_in_the_include_list(self):
# plugins Ids.
include = ["foo", "bar"]

plugin_manager = PluginManager(
include=include,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)
with self.assertWarns(DeprecationWarning):
plugin_manager = PluginManager(
include=include,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)

# The Ids of the plugins that we expect the plugin manager to find.
expected = ["foo", "bar"]
Expand All @@ -167,14 +168,15 @@ def test_only_include_plugins_matching_a_wildcard_in_the_include_list(
# plugins Ids.
include = ["b*"]

plugin_manager = PluginManager(
include=include,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)
with self.assertWarns(DeprecationWarning):
plugin_manager = PluginManager(
include=include,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)

# The Ids of the plugins that we expect the plugin manager to find.
expected = ["bar", "baz"]
Expand All @@ -189,14 +191,15 @@ def test_ignore_plugins_whose_ids_are_in_the_exclude_list(self):
# plugins Ids.
exclude = ["foo", "baz"]

plugin_manager = PluginManager(
exclude=exclude,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)
with self.assertWarns(DeprecationWarning):
plugin_manager = PluginManager(
exclude=exclude,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)

# The Ids of the plugins that we expect the plugin manager to find.
expected = ["bar"]
Expand All @@ -211,14 +214,15 @@ def test_ignore_plugins_matching_a_wildcard_in_the_exclude_list(self):
# plugins Ids.
exclude = ["b*"]

plugin_manager = PluginManager(
exclude=exclude,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)
with self.assertWarns(DeprecationWarning):
plugin_manager = PluginManager(
exclude=exclude,
plugins=[
SimplePlugin(id="foo"),
SimplePlugin(id="bar"),
SimplePlugin(id="baz"),
],
)

# The Ids of the plugins that we expect the plugin manager to find.
expected = ["foo"]
Expand Down