Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed extraneous blank line on non-interactive disabled `Progress` https://github.com/Textualize/rich/pull/3905

## [14.2.0] - 2025-10-09

### Changed
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The following people have contributed to the development of Rich:
- [Motahhar Mokfi](https://github.com/motahhar)
- [Tomer Shalev](https://github.com/tomers)
- [Serkan UYSAL](https://github.com/uysalserkan)
- [Tomer Yogev](https://github.com/TomerYogev)
- [Zhe Huang](https://github.com/onlyacat)
- [Adrian Zuber](https://github.com/xadrianzetx)
- [Ke Sun](https://github.com/ksun212)
Expand Down
7 changes: 4 additions & 3 deletions rich/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,10 @@ def start(self) -> None:

def stop(self) -> None:
"""Stop the progress display."""
self.live.stop()
if not self.console.is_interactive and not self.console.is_jupyter:
self.console.print()
if not self.disable:
self.live.stop()
if not self.console.is_interactive and not self.console.is_jupyter:
self.console.print()

def __enter__(self) -> Self:
self.start()
Expand Down
24 changes: 24 additions & 0 deletions tests/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,30 @@ def test_no_output_if_progress_is_disabled() -> None:
assert result == expected


def test_no_output_if_progress_is_disabled_non_interactive() -> None:
console = Console(
file=io.StringIO(),
force_interactive=False,
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


def test_open() -> None:
console = Console(
file=io.StringIO(),
Expand Down