Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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('exopy.app.dependencies')
    cls = type(plugin.build_deps.contributions['exopy.task'])

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

    monkeypatch.setitem(plugin.build_deps.contributions, 'exopy.task',
                        FalseCollector())
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Exemplo n.º 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('exopy.app.dependencies')
    cls = type(plugin.build_deps.contributions['exopy.task'])

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

    monkeypatch.setitem(plugin.build_deps.contributions, 'exopy.task',
                        FalseCollector())
    with pytest.raises(RuntimeError):
        build_task_from_config(task_config, task_workbench)
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 7
0
def test_build_from_config(task_workbench, task_config):
    """Test creating a task from a config object.

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

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

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

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