added more tests, added support for coverage

This commit is contained in:
antirotor 2019-06-28 21:29:58 +02:00
parent c1de475c58
commit ed57514579
No known key found for this signature in database
GPG key ID: 8A29C663C672C2B7
3 changed files with 35 additions and 1 deletions

15
.gitignore vendored
View file

@ -12,3 +12,18 @@ __pycache__/
# Editor backup files #
#######################
*~
# Unit test / coverage reports
##############################
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
/coverage
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

0
pype/.coveragerc Normal file
View file

View file

@ -6,7 +6,7 @@ from pype.lib import filter_pyblish_plugins
import os
def test_pyblish_plugin_filter(printer, monkeypatch):
def test_pyblish_plugin_filter_modifier(printer, monkeypatch):
"""
Test if pyblish filter can filter and modify plugins on-the-fly.
"""
@ -39,3 +39,22 @@ def test_pyblish_plugin_filter(printer, monkeypatch):
assert plugins[0].optional is True
lib.teardown()
def test_pyblish_plugin_filter_removal(monkeypatch):
""" Test that plugin can be removed by filter """
lib.setup_empty()
monkeypatch.setitem(os.environ, 'PYBLISHPLUGINPATH', '')
plugins = pyblish.api.registered_plugins()
class MyTestRemovedPlugin(pyblish.api.InstancePlugin):
my_test_property = 1
label = "Collect Renderable Camera(s)"
hosts = ["test"]
families = ["default"]
pyblish.api.register_host("test")
pyblish.api.register_plugin(MyTestRemovedPlugin)
pyblish.api.register_discovery_filter(filter_pyblish_plugins)
plugins = pyblish.api.discover()
assert len(plugins) == 0