コード例 #1
0
ファイル: cli.py プロジェクト: twx7d3/python-graphwalker
def build(ns):
    reporter = reporting.build(sum(ns.reporters, []))

    ns.planners = ns.planners or [['Random']]
    plan = planning.build(sum(ns.planners, []))

    stop = halting.build(ns.stop)

    model, actor = load_model_actor(ns)

    debugger = ns.debug and ns.debugger

    exe = execution.Executor(actor, reporter, debugger)

    context = {
        'suite': ns.suite,
        'test': ns.test,
        'ns': ns,
        'model': model,
        'actor': actor,
        'debugger': debugger,
        'executor': exe,
        'plan': plan,
        'stop': stop,
        'reporter': reporter,
    }
    context['context'] = context

    return context
コード例 #2
0
    def test_by_interaction(self):
        r"""Interaction self-test.

        For comparison, try this:

            PYTHONPATH=. python graphwalker/cli.py --reporter=Print \
              graphwalker/test/examples/selftest.graphml \
              graphwalker.test.interactor.Interactor
        """
        outer = self

        class HijackReporter(reporting.ReportingPlugin):
            def finalize(self, failure=False):
                outer.assertFalse(failure)

        reporter = HijackReporter()
        plan = planning.build(['Random'])
        stop = halting.build('Coverage')
        model = graph.Graph.read('graphwalker/test/examples/selftest.graphml')
        actor = 'graphwalker.test.interactor.Interactor'
        exe = execution.Executor(actor, reporter)

        context = {
            'plan': plan, 'stop': stop, 'actor': actor,
            'reporter': reporter, 'executor': exe, 'model': model}

        stop.start(model, context)
        path = plan(model, stop, 'Start', context)

        exe.run('inner', path, context)
コード例 #3
0
    def test_by_interaction(self):
        r"""Interaction self-test.

        For comparison, try this:

            PYTHONPATH=. python graphwalker/cli.py --reporter=Print \
              graphwalker/test/examples/selftest.graphml \
              graphwalker.test.interactor.Interactor
        """
        outer = self

        class HijackReporter(reporting.ReportingPlugin):
            def finalize(self, failure=False):
                outer.assertFalse(failure)

        reporter = HijackReporter()
        plan = planning.build(['Random'])
        stop = halting.build('Coverage')
        model = graph.Graph.read('graphwalker/test/examples/selftest.graphml')
        actor = 'graphwalker.test.interactor.Interactor'
        exe = execution.Executor(actor, reporter)

        context = {
            'plan': plan,
            'stop': stop,
            'actor': actor,
            'reporter': reporter,
            'executor': exe,
            'model': model
        }

        stop.start(model, context)
        path = plan(model, stop, 'Start', context)

        exe.run('inner', path, context)
コード例 #4
0
ファイル: cli.py プロジェクト: algo-dogs/python-graphwalker
def build(ns):
    reporter = reporting.build(sum(ns.reporters, []))

    ns.planners = ns.planners or [['Random']]
    plan = planning.build(sum(ns.planners, []))

    stop = halting.build(ns.stop)

    model, actor = load_model_actor(ns)

    debugger = ns.debug and ns.debugger

    exe = execution.Executor(actor, reporter, debugger)

    context = {
        'suite': ns.suite, 'test': ns.test, 'ns': ns,
        'model': model, 'actor': actor, 'debugger': debugger, 'executor': exe,
        'plan': plan, 'stop': stop, 'reporter': reporter,
    }
    context['context'] = context

    return context