disabled progress does not start live

This commit is contained in:
JoshKarpel 2021-03-21 10:19:10 -05:00
parent c354260e6b
commit 9e397a13db
2 changed files with 16 additions and 1 deletions

View File

@ -634,7 +634,8 @@ class Progress(JupyterMixin):
def start(self) -> None:
"""Start the progress display."""
self.live.start(refresh=True)
if not self.disable:
self.live.start(refresh=True)
def stop(self) -> None:
"""Stop the progress display."""

View File

@ -434,6 +434,20 @@ def test_progress_max_refresh() -> None:
)
def test_live_is_started_if_progress_is_enabled() -> None:
progress = Progress(auto_refresh=False, disable=False)
with progress:
assert progress.live._started
def test_live_is_not_started_if_progress_is_disabled() -> None:
progress = Progress(auto_refresh=False, disable=True)
with progress:
assert not progress.live._started
if __name__ == "__main__":
_render = render_progress()
print(_render)