mirror of https://github.com/Textualize/rich.git
test that Progress writes nothing when disabled
This commit is contained in:
parent
3e079ff52b
commit
34c56204e9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue