Skip to content

Commit

Permalink
Merge pull request #1 from mottosso/patch-1
Browse files Browse the repository at this point in the history
Consider inactive collectors
  • Loading branch information
linez69 committed May 30, 2016
2 parents fe23525 + cf60145 commit a865145
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ def on_discover(plugins, context):
base=pyblish.api.Collector.order):
continue

if not plugin.active:
continue

collectors.append(plugin)

self.run(collectors, context,
Expand Down
29 changes: 29 additions & 0 deletions tests/test_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,32 @@ def process(self, instance):

assert len(validate_actions) == 0, (
"ValidateAction should not have had an action")


def test_inactive_collector():
"""An inactive collector should not run"""

count = {"#": 0}

class MyInactiveCollector(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder
active = False

def process(self, context):
print("Ran %s" % type(self))
count["#"] += 1

class MyActiveCollector(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder
active = True

def process(self, context):
print("Ran %s" % type(self))
count["#"] += 10

pyblish.api.register_plugin(MyInactiveCollector)
pyblish.api.register_plugin(MyActiveCollector)

reset()

assert count["#"] == 10

0 comments on commit a865145

Please sign in to comment.