tqdm/tests/tests_dask.py

19 lines
467 B
Python
Raw Permalink Normal View History

2021-03-05 13:17:39 +00:00
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)]
2021-03-05 14:13:28 +00:00
with ProgressBar(desc="computing"):
2021-03-05 13:17:39 +00:00
dask.compute(schedule)
_, err = capsys.readouterr()
2021-03-05 14:13:28 +00:00
assert "computing: " in err
2021-03-05 13:17:39 +00:00
assert '5/5' in err