Skip to content

Commit 3b080ac

Browse files
authored
Release upper bound of click dependency (#746)
* Release upper bound of click dependency * Fix CliRunner usage after click==8.2 upgrade * Adjust CliRunner for click< and > 8.2
1 parent a4940bd commit 3b080ac

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

robotidy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.17.0"
1+
__version__ = "4.18.0"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
python_requires=">=3.8",
4343
install_requires=[
4444
"robotframework>=4.0",
45-
"click==8.1.*",
45+
"click>=8.1",
4646
"colorama>=0.4.3",
4747
"pathspec>=0.9.0",
4848
"tomli>=2.0",

tests/atest/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
from pathlib import Path
77

88
import pytest
9-
from click.testing import CliRunner
109
from packaging import version
1110
from packaging.specifiers import SpecifierSet
1211
from rich.console import Console
1312
from robot.version import VERSION as RF_VERSION
1413

1514
from robotidy.cli import cli
1615
from robotidy.utils.misc import decorate_diff_with_color
16+
from tests.utils import cli_runner
1717

1818
VERSION_MATRIX = {"ReplaceReturns": 5, "InlineIf": 5, "ReplaceBreakContinue": 5, "Translate": 6, "ReplaceWithVAR": 7}
1919
ROBOT_VERSION = version.parse(RF_VERSION)
@@ -75,7 +75,7 @@ def run_tidy(
7575
):
7676
if not self.enabled_in_version(target_version):
7777
pytest.skip(f"Test enabled only for RF {target_version}")
78-
runner = CliRunner(mix_stderr=False)
78+
runner = cli_runner()
7979
output_path = str(self.TRANSFORMERS_DIR / "actual" / source)
8080
arguments = ["--output", output_path]
8181
if not_modified:
@@ -117,7 +117,7 @@ class MultipleConfigsTest:
117117
ROOT_DIR = Path(__file__).parent / "configuration_files"
118118

119119
def run_tidy(self, tmpdir, args: list[str] | None = None, exit_code: int = 0, not_modified: bool = False):
120-
runner = CliRunner(mix_stderr=False)
120+
runner = cli_runner()
121121
temporary_dir = tmpdir / self.TEST_DIR
122122
shutil.copytree(self.ROOT_DIR / self.TEST_DIR / "source", temporary_dir)
123123
arguments = []

tests/e2e/test_transform_stability.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from pathlib import Path
66

77
import pytest
8-
from click.testing import CliRunner
98

109
from robotidy.cli import cli
1110
from robotidy.transformers import TransformConfigMap, load_transformers
1211
from robotidy.utils.misc import ROBOT_VERSION
12+
from tests.utils import cli_runner
1313

1414
RERUN_NEEDED_4 = {
1515
"RenameKeywords": {"run_keywords": 2, "disablers": 2},
@@ -78,7 +78,7 @@
7878
def run_tidy(cmd, enable_disabled: bool):
7979
if enable_disabled:
8080
cmd = get_enable_disabled_config() + cmd
81-
runner = CliRunner(mix_stderr=False)
81+
runner = cli_runner()
8282
return runner.invoke(cli, cmd)
8383

8484

tests/utest/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
from pathlib import Path
44

5-
from click.testing import CliRunner
6-
75
from robotidy.cli import cli
6+
from tests.utils import cli_runner
87

98

109
def run_tidy(
@@ -14,7 +13,7 @@ def run_tidy(
1413
std_in: str | None = None,
1514
overwrite_input: bool = False,
1615
):
17-
runner = CliRunner(mix_stderr=False)
16+
runner = cli_runner()
1817
arguments = args if args is not None else []
1918
if not overwrite_input:
2019
if output:

tests/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from click.testing import CliRunner
2+
3+
4+
def cli_runner():
5+
try:
6+
return CliRunner(mix_stderr=False)
7+
except TypeError:
8+
return CliRunner()

0 commit comments

Comments
 (0)