summaryrefslogtreecommitdiffstats
path: root/tests/tests_dask.py
blob: 16992bf3e22e8b200b10de0ee20ca3a2eda17170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from time import sleep

from .tests_tqdm import importorskip, mark

pytestmark = mark.slow


def test_dask(capsys):
    """Test tqdm.dask.TqdmCallback"""
    ProgressBar = importorskip('tqdm.dask').TqdmCallback
    dask = importorskip('dask')

    schedule = [dask.delayed(sleep)(i / 10) for i in range(5)]
    with ProgressBar(desc="computing"):
        dask.compute(schedule)
    _, err = capsys.readouterr()
    assert "computing: " in err
    assert '5/5' in err