mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
fix for is_terminal
This commit is contained in:
parent
076e0d208e
commit
00181151a4
3 changed files with 19 additions and 1 deletions
|
@ -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).
|
||||
|
||||
## [13.3.4] - 2023-04-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed for `is_terminal` ignoring FORCE_COLOR
|
||||
|
||||
## [13.3.3] - 2023-02-27
|
||||
|
||||
### Added
|
||||
|
|
|
@ -952,6 +952,7 @@ class Console:
|
|||
force_color = self._environ.get("FORCE_COLOR")
|
||||
if force_color is not None:
|
||||
self._force_terminal = True
|
||||
return True
|
||||
|
||||
isatty: Optional[Callable[[], bool]] = getattr(self.file, "isatty", None)
|
||||
try:
|
||||
|
@ -2000,7 +2001,6 @@ class Console:
|
|||
self._record_buffer.extend(self._buffer[:])
|
||||
|
||||
if self._buffer_index == 0:
|
||||
|
||||
if self.is_jupyter: # pragma: no cover
|
||||
from .jupyter import display
|
||||
|
||||
|
|
|
@ -979,3 +979,15 @@ def test_force_color_jupyter():
|
|||
file=io.StringIO(), _environ={"FORCE_COLOR": "1"}, force_jupyter=True
|
||||
)
|
||||
assert not console.is_terminal
|
||||
|
||||
|
||||
def test_force_color():
|
||||
console = Console(
|
||||
file=io.StringIO(),
|
||||
_environ={
|
||||
"FORCE_COLOR": "1",
|
||||
"TERM": "xterm-256color",
|
||||
"COLORTERM": "truecolor",
|
||||
},
|
||||
)
|
||||
assert console.color_system == "truecolor"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue