Skip to content

Commit

Permalink
Implemented in #196
Browse files Browse the repository at this point in the history
  • Loading branch information
mottosso committed Jun 9, 2015
1 parent 2bf26e6 commit b989501
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyblish/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,9 @@ def discover(type=None, regex=None, paths=None):
continue

for fname in os.listdir(path):
if fname.startswith("_"):
continue

abspath = os.path.join(path, fname)

if not os.path.isfile(abspath):
Expand Down
32 changes: 32 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,35 @@ def _current_host():
finally:
sys.executable = old


@with_setup(lib.setup_empty, lib.teardown)
def test_temporarily_disabled_plugins():
"""Plug-ins as files starting with an underscore are hidden"""

discoverable = """
import pyblish.api
class Discoverable(pyblish.api.Plugin):
pass
"""

notdiscoverable = """
import pyblish.api
class NotDiscoverable(pyblish.api.Plugin):
pass
"""

with tempdir() as d:
pyblish.api.register_plugin_path(d)

with open(os.path.join(d, "discoverable.py"), "w") as f:
f.write(discoverable)

with open(os.path.join(d, "_undiscoverable.py"), "w") as f:
f.write(notdiscoverable)


plugins = [p.__name__ for p in pyblish.api.discover()]
assert "Discoverable" in plugins
assert "NotDiscoverable" not in plugins

0 comments on commit b989501

Please sign in to comment.