Example #1
0
def test_build_from_config_analyse_dep_failure(task_workbench, task_config):
    """Test creating a task from a config object.

    """
    task_config['task_id'] = '__dummy__'
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Example #2
0
def test_build_from_config_analyse_dep_failure(task_workbench, task_config):
    """Test creating a task from a config object.

    """
    task_config['task_id'] = '__dummy__'
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Example #3
0
def test_build_from_config_collecting_dep_failure(task_workbench, task_config,
                                                  monkeypatch):
    """Test creating a task from a config object.

    """
    plugin = task_workbench.get_plugin('ecpy.app.dependencies')
    cls = type(plugin.build_deps.contributions['ecpy.task'])

    class FalseCollector(cls):
        def collect(self, kind, dependencies, owner=None):
            raise RuntimeError()

    monkeypatch.setitem(plugin.build_deps.contributions, 'ecpy.task',
                        FalseCollector())
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Example #4
0
def test_build_from_config_collecting_dep_failure(task_workbench, task_config,
                                                  monkeypatch):
    """Test creating a task from a config object.

    """
    plugin = task_workbench.get_plugin('ecpy.app.dependencies')
    cls = type(plugin.build_deps.contributions['ecpy.task'])

    class FalseCollector(cls):
        def collect(self, kind, dependencies, owner=None):
            raise RuntimeError()

    monkeypatch.setitem(plugin.build_deps.contributions, 'ecpy.task',
                        FalseCollector())
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Example #5
0
def test_build_from_config_as_root(task_workbench, task_config):
    """Test creating a root task from a config object.

    """
    task = build_task_from_config(task_config, task_workbench, True)

    assert task.name == 'Root'
    assert type(task).__name__ == 'RootTask'
Example #6
0
def test_build_from_config_as_root(task_workbench, task_config):
    """Test creating a root task from a config object.

    """
    task = build_task_from_config(task_config, task_workbench, True)

    assert task.name == 'Root'
    assert type(task).__name__ == 'RootTask'
Example #7
0
def test_build_from_config(task_workbench, task_config):
    """Test creating a task from a config object.

    """
    from ecpy.tasks.api import ComplexTask
    task = build_task_from_config(task_config,
                                  {'ecpy.task':
                                      {'ecpy.ComplexTask': ComplexTask}})

    assert task.name == 'Test'
    assert isinstance(task, ComplexTask)
Example #8
0
def test_build_from_config(task_workbench, task_config):
    """Test creating a task from a config object.

    """
    from ecpy.tasks.api import ComplexTask
    task = build_task_from_config(
        task_config, {'ecpy.task': {
            'ecpy.ComplexTask': ComplexTask
        }})

    assert task.name == 'Test'
    assert isinstance(task, ComplexTask)