Skip to content

Commit

Permalink
test that Progress writes nothing when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel committed Mar 25, 2021
1 parent 3e079ff commit 34c5620
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_progress.py
Expand Up @@ -448,6 +448,30 @@ def test_live_is_not_started_if_progress_is_disabled() -> None:
assert not progress.live._started


def test_no_output_if_progress_is_disabled() -> None:
console = Console(
file=io.StringIO(),
force_terminal=True,
width=60,
color_system="truecolor",
legacy_windows=False,
_environ={},
)
progress = Progress(
console=console,
disable=True,
)
test = ["foo", "bar", "baz"]
expected_values = iter(test)
with progress:
for value in progress.track(test, description="test"):
assert value == next(expected_values)
result = console.file.getvalue()
print(repr(result))
expected = ""
assert result == expected


if __name__ == "__main__":
_render = render_progress()
print(_render)
Expand Down

0 comments on commit 34c5620

Please sign in to comment.