Ejemplo n.º 1
0
def test_custom_data():
    """Data as a side-car file works fine"""
    runner = CliRunner()

    with runner.isolated_filesystem():
        with open("data.yaml", "w") as f:
            yaml.dump({"key": "value"}, f)

        runner.invoke(pyblish.cli.main, ["publish"])

        assert_equals(context().data("key"), "value")
Ejemplo n.º 2
0
def test_corrupt_custom_configuration():
    """Bad configuration stops the publish"""
    runner = CliRunner()

    class DoesNotRun(pyblish.api.Selector):
        def process(self, context):
            context.create_instance("MyInstance")

    with runner.isolated_filesystem():
        with open("config.yaml", "w") as f:
            f.write("[{gf$$%$}")

        runner.invoke(pyblish.cli.main, ["publish"])

    assert_equals(len(context()), 0)
Ejemplo n.º 3
0
def test_custom_configuration():
    """Configuration as a side-car file works fine"""
    runner = CliRunner()

    with runner.isolated_filesystem():
        with open("select_instances.py", "w") as f:
            f.write("""

import pyblish.api

class SelectInstances(pyblish.api.Selector):
    def process_context(self, context):
        context.set_data("key", "value")

""")

        with open("config.yaml", "w") as f:
            yaml.dump({"paths": [os.getcwd()]}, f)

        runner.invoke(pyblish.cli.main, ["publish"])

        assert_equals(context().data("key"), "value")