def test_all_commands_run(mock_pip): """All commands run without error""" # The CLI will ask for which version of pip # is currently installed. Assume the correct # version. mock_pip.__version__ = mock.MagicMock(return_value=(1, 5)) for args in [[], ['--verbose'], ['publish'], ['install', 'test'], ['uninstall', 'test'], ['packages'], ['config']]: runner = CliRunner() result = runner.invoke(pyblish.cli.main, args) print "Args: %s" % args print "Exit code: %s" % result.exit_code print "Output: %s" % result.output assert result.exit_code >= 0
"""Mockup of potential integration with 3rd-party task managment suite""" import pyblish.api from pyblish.vendor import mock api = mock.MagicMock() class ConformInstancesFail(pyblish.api.Conformer): hosts = ['python'] families = ['test.family'] version = (0, 1, 0) def process_instance(self, instance): raise ValueError("Test fail")
import os import sys import warnings # Expose Pyblish to PYTHONPATH path = os.path.dirname(__file__) sys.path.insert(0, path) import nose from pyblish.vendor import mock warnings.warn = mock.MagicMock() if __name__ == '__main__': argv = sys.argv[:] argv.extend(['--exclude=vendor', '--with-doctest', '--verbose']) nose.main(argv=argv)