rich/tests/conftest.py
Michał Górny 7d79acbabf 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
2023-12-09 15:25:21 +01:00

8 lines
245 B
Python

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)