From 29df65477090b38e3fd3a4e8b2a2afadce85ab2e Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Wed, 19 Feb 2025 12:16:32 +0200 Subject: [PATCH] Fix the test suite with click 8.2.0 The `mix_stderr` parameter to the `CliRunner` constructor was dropped, so only pass it conditionally on the `click` version. --- tests/test_files_to_prompt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_files_to_prompt.py b/tests/test_files_to_prompt.py index 5268995..72b8e2e 100644 --- a/tests/test_files_to_prompt.py +++ b/tests/test_files_to_prompt.py @@ -1,8 +1,10 @@ import os import pytest import re +from importlib.metadata import version as imp_version from click.testing import CliRunner +from packaging.version import Version from files_to_prompt.cli import cli @@ -235,7 +237,10 @@ def test_mixed_paths_with_options(tmpdir): def test_binary_file_warning(tmpdir): - runner = CliRunner(mix_stderr=False) + if Version(imp_version("click")) >= Version("8.2.0"): + runner = CliRunner() + else: + runner = CliRunner(mix_stderr=False) with tmpdir.as_cwd(): os.makedirs("test_dir") with open("test_dir/binary_file.bin", "wb") as f: