Exemplo n.º 1
0
def test_convenience_plugins_argument():
    """util._convenience() `plugins` argument works

    Issue: #286

    """

    count = {"#": 0}

    class PluginA(api.ContextPlugin):
        order = api.CollectorOrder

        def process(self, context):
            count["#"] += 1

    class PluginB(api.ContextPlugin):
        order = api.CollectorOrder

        def process(self, context):
            count["#"] += 10

    assert count["#"] == 0

    api.register_plugin(PluginA)
    util._convenience(0.5, plugins=[PluginB])

    assert count["#"] == 10, count
Exemplo n.º 2
0
def test_convenience_plugins_argument():
    """util._convenience() `plugins` argument works

    Issue: #286

    """

    count = {"#": 0}

    class PluginA(api.ContextPlugin):
        order = api.CollectorOrder

        def process(self, context):
            count["#"] += 1

    class PluginB(api.ContextPlugin):
        order = api.CollectorOrder

        def process(self, context):
            count["#"] += 10

    assert count["#"] == 0

    api.register_plugin(PluginA)
    util._convenience(plugins=[PluginB], order=0.5)

    assert count["#"] == 10, count