Exemple #1
0
def test_values(loop):
    with cluster() as (c, [a, b]):
        with Executor(('127.0.0.1', c['port']), loop=loop) as e:
            L = [e.submit(inc, i) for i in range(5)]
            wait(L)
            p = MultiProgressWidget(L)
            p.start()
            assert set(p.all_keys) == {'inc'}
            assert len(p.all_keys['inc']) == 5
            assert p.status == 'finished'
            assert not p.pc.is_running()
            assert p.texts['inc'].value == '5 / 5'
            assert p.bars['inc'].value == 1.0

            x = e.submit(throws, 1)
            p = MultiProgressWidget([x])
            p.start()
            assert p.status == 'error'
            assert p.bars[p.func(x.key)].value == 1.0