From a5eada7ac4c00a64920f6bec4ecb6e87a506f8c4 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Wed, 19 May 2021 16:50:09 +0100 Subject: [PATCH] fix status text --- .github/workflows/pythonpackage.yml | 2 +- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- rich/spinner.py | 2 +- tests/test_spinner.py | 7 +++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9685a6f5..ca54055d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a51855..d4a0a53d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index c70a52f5..9a2b89da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "MIT" diff --git a/rich/spinner.py b/rich/spinner.py index b3d9d9c0..5b5ae36b 100644 --- a/rich/spinner.py +++ b/rich/spinner.py @@ -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 diff --git a/tests/test_spinner.py b/tests/test_spinner.py index 28aac7fc..b3814abb 100644 --- a/tests/test_spinner.py +++ b/tests/test_spinner.py @@ -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" \ No newline at end of file