コード例 #1
0
ファイル: test_execution.py プロジェクト: tate11/bonobo
def test_simple_execution_context():
    graph = Graph()
    graph.add_chain(*chain)

    context = GraphExecutionContext(graph)
    assert len(context.nodes) == len(chain)
    assert not len(context.plugins)

    for i, node in enumerate(chain):
        assert context[i].wrapped is node

    assert not context.alive
    assert not context.started
    assert not context.stopped

    context.write(BEGIN, (), END)

    assert not context.alive
    assert not context.started
    assert not context.stopped

    context.start()

    assert context.alive
    assert context.started
    assert not context.stopped

    context.stop()

    assert not context.alive
    assert context.started
    assert context.stopped
コード例 #2
0
ファイル: test_execution.py プロジェクト: tate11/bonobo
def test_empty_execution_context():
    graph = Graph()

    ctx = GraphExecutionContext(graph)
    assert not len(ctx.nodes)
    assert not len(ctx.plugins)

    assert not ctx.alive
コード例 #3
0
def test_one_pass():
    plugin = ConsoleOutputPlugin()
    dispatcher = EventDispatcher()
    plugin.register(dispatcher)

    graph = bonobo.Graph()
    context = MagicMock(spec=GraphExecutionContext(graph))

    dispatcher.dispatch(events.START, events.ExecutionEvent(context))
    dispatcher.dispatch(events.TICK, events.ExecutionEvent(context))
    dispatcher.dispatch(events.STOPPED, events.ExecutionEvent(context))

    plugin.unregister(dispatcher)
コード例 #4
0
 def __init__(self, *args, buffer=None, **kwargs):
     BufferingContext.__init__(self, buffer)
     GraphExecutionContext.__init__(self, *args, **kwargs)
コード例 #5
0
ファイル: testing.py プロジェクト: a-musing-moose/bonobo
 def __init__(self, *args, buffer=None, **kwargs):
     BufferingContext.__init__(self, buffer)
     GraphExecutionContext.__init__(self, *args, **kwargs)