fix status text

This commit is contained in:
Will McGugan 2021-05-19 16:50:09 +01:00
parent fd4f1bc5d0
commit a5eada7ac4
5 changed files with 16 additions and 3 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10]
defaults:
run:
shell: bash

View File

@ -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).
## [10.2.2] - 2021-05-19
### Fixed
- Fixed status not rendering console markup https://github.com/willmcgugan/rich/issues/1244
## [10.2.1] - 2021-05-17
### Fixed

View File

@ -2,7 +2,7 @@
name = "rich"
homepage = "https://github.com/willmcgugan/rich"
documentation = "https://rich.readthedocs.io/en/latest/"
version = "10.2.1"
version = "10.2.2"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
authors = ["Will McGugan <willmcgugan@gmail.com>"]
license = "MIT"

View File

@ -34,7 +34,7 @@ class Spinner:
spinner = SPINNERS[name]
except KeyError:
raise KeyError(f"no spinner called {name!r}")
self.text = text
self.text = Text.from_markup(text) if isinstance(text, str) else text
self.frames = cast(List[str], spinner["frames"])[:]
self.interval = cast(float, spinner["interval"])
self.start_time: Optional[float] = None

View File

@ -4,6 +4,7 @@ from rich.console import Console
from rich.measure import Measurement
from rich.rule import Rule
from rich.spinner import Spinner
from rich.text import Text
def test_spinner_create():
@ -65,3 +66,9 @@ def test_rich_measure():
min_width, max_width = Measurement.get(console, console.options, spinner)
assert min_width == 3
assert max_width == 5
def test_spinner_markup():
spinner = Spinner("dots", "[bold]spinning[/bold]")
assert isinstance(spinner.text, Text)
assert str(spinner.text) == "spinning"