Skip to content

Commit

Permalink
make the call conditional on click version
Browse files Browse the repository at this point in the history
  • Loading branch information
MeggyCal committed Feb 10, 2025
1 parent df50f6c commit a65eb89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager, redirect_stderr
from dataclasses import fields, replace
from importlib.metadata import version as imp_version
from io import BytesIO
from pathlib import Path, WindowsPath
from platform import system
Expand All @@ -26,6 +27,7 @@
from click import unstyle
from click.testing import CliRunner
from pathspec import PathSpec
from packaging.version import Version

import black
import black.files
Expand Down Expand Up @@ -114,7 +116,10 @@ class BlackRunner(CliRunner):
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""

def __init__(self) -> None:
super().__init__()
if Version(imp_version('click')) >= Version('8.2.0'):
super().__init__()
else:
super().__init__(mix_stderr=False)


def invokeBlack(
Expand Down

0 comments on commit a65eb89

Please sign in to comment.