Skip to content
Myr

Add missing fake clock in termui tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jan Christoph Bischko · committed by Jan Christoph Bischko · parent 3247cf1 · Browse files · 1 file+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−2 removed

  • tests:+7 added−2 removed

1 file+7 added−2 removed

modified:tests/test_termui.py+7 added-2 removed
45 unmodified lines
46 raise StopIteration4748 next = __next__4950 fake_clock = FakeClock()5152 @click.command()53 def cli():54 with click.progressbar(Hinted(10), label='test') as progress:55 for thing in progress:54 time.sleep(.5)56 fake_clock.advance_time()5758 monkeypatch.setattr(time, 'time', fake_clock.time)59 monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)60 result = runner.invoke(cli, [])61 assert result.exception is None626364def test_progressbar_hidden(runner, monkeypatch):65 fake_clock = FakeClock()66 label = 'whatever'6768 @click.command()69 def cli():70 with click.progressbar(tuple(range(10)), label=label) as progress:71 for thing in progress:68 pass72 fake_clock.advance_time()7374 monkeypatch.setattr(time, 'time', fake_clock.time)75 monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: False)76 assert runner.invoke(cli, []).output == ''7778
52 unmodified lines