diff --git a/tests/test_utils_run_later.py b/tests/test_utils_run_later.py index 93cabc7af..83047ab15 100644 --- a/tests/test_utils_run_later.py +++ b/tests/test_utils_run_later.py @@ -1,6 +1,4 @@ import pytest -import io -from contextlib import redirect_stdout import time_machine from datetime import datetime, timedelta @@ -114,19 +112,16 @@ def test_run_later_with_past_datetime(capsys): assert "it is already past" in captured assert "Triggered: TOO LATE" not in captured -def test_run_at_tqdm_multiple_updates(monkeypatch): - - output = io.StringIO() +def test_run_at_tqdm_multiple_updates(monkeypatch, capsys): def fexample(): print("Function done!") when = datetime.now() + timedelta(seconds=0.2) - with redirect_stdout(output): - run_at(when, fexample) - - captured = output.getvalue() + run_at(when, fexample) + + captured = capsys.readouterr().out assert "0%| |" in captured assert "50%|█████ |" in captured