Merge pull request #1648 from willmcgugan/non-interactive-progress

fix for missing newline
This commit is contained in:
Will McGugan 2021-11-06 12:43:59 +00:00 committed by GitHub
commit ddffdebffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed an edge case bug when console module try to detect if they are in a tty at the end of a pytest run
- Fixed issue with TERM env vars that have more than one hyphen https://github.com/willmcgugan/rich/issues/1640
- Fixed missing new line after progress bar when terminal is not interactive https://github.com/willmcgugan/rich/issues/1606
- Fixed exception in IPython when disabling pprint with %pprint https://github.com/willmcgugan/rich/issues/1646
## [10.12.0] - 2021-10-06

View File

@ -159,6 +159,8 @@ class Live(JupyterMixin, RenderHook):
# jupyter last refresh must occur after console pop render hook
# i am not sure why this is needed
self.refresh()
if not self.console.is_interactive:
return self.console.print()
def __enter__(self) -> "Live":
self.start(refresh=self._renderable is not None)

View File

@ -158,7 +158,7 @@ def test_growing_display_file_console() -> None:
output = console.end_capture()
assert (
output
== "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n"
== "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n\n"
)