Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix color handling in test runner #2729

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Unreleased
multiple lines. :issue:`2697`
- Fixed issue that prevented a default value of ``""`` from being displayed in
the help for an option. :issue:`2500`
- The test runner handles stripping color consistently on Windows.
:issue:`2705`


Version 8.1.7
Expand Down
2 changes: 2 additions & 0 deletions src/click/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import typing as t
from types import TracebackType

from . import _compat
from . import formatting
from . import termui
from . import utils
Expand Down Expand Up @@ -315,6 +316,7 @@ def should_strip_ansi(
termui.hidden_prompt_func = hidden_input
termui._getchar = _getchar
utils.should_strip_ansi = should_strip_ansi # type: ignore
_compat.should_strip_ansi = should_strip_ansi

old_env = {}
try:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

import click
from click._compat import WIN
from click.testing import CliRunner


Expand Down Expand Up @@ -184,7 +183,6 @@ def cli():
assert result.exit_code == 1


@pytest.mark.skipif(WIN, reason="Test does not make sense on Windows.")
def test_with_color():
@click.command()
def cli():
Expand Down