mirror of https://github.com/Textualize/rich.git
Fix running tests in environment with FORCE_COLOR or NO_COLOR set
Ensure to unset FORCE_COLOR and NO_COLOR environment variables within the scope of individual tests, in order to fix test failures when these variables are set in the environment where tests are run, e.g. via: NO_COLOR=1 tox
This commit is contained in:
parent
fd98182364
commit
7d79acbabf
|
@ -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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Running tests in environment with `FORCE_COLOR` or `NO_COLOR` environment variables
|
||||||
|
|
||||||
## [13.7.0] - 2023-11-15
|
## [13.7.0] - 2023-11-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def reset_color_envvars(monkeypatch):
|
||||||
|
"""Remove color-related envvars to fix test output"""
|
||||||
|
monkeypatch.delenv("FORCE_COLOR", raising=False)
|
||||||
|
monkeypatch.delenv("NO_COLOR", raising=False)
|
Loading…
Reference in New Issue