diff --git a/rich/progress.py b/rich/progress.py index 8a246ee5..4f96d111 100644 --- a/rich/progress.py +++ b/rich/progress.py @@ -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.""" diff --git a/tests/test_progress.py b/tests/test_progress.py index cca4ad6f..3d40d2e3 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -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)