Skip to content

Commit 5c031f0

Browse files
committed
Dependencies: Permit installation of click 8.3
1 parent 16acf5d commit 5c031f0

5 files changed

Lines changed: 31 additions & 23 deletions

File tree

CHANGES.md

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

33
## Unreleased
44

5+
- Dependencies: Permitted installation of click 8.3
6+
57
## 2026/03/16 v0.0.46
68
- I/O: API improvements: `ctk {load,save} table` became `ctk {load,save}`
79
Also, the `--cluster-url` option becomes optional. That's a much more

cratedb_toolkit/cfr/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def job_statistics(ctx: click.Context):
109109
@click.option(
110110
"--anonymize",
111111
type=str,
112-
is_flag=False,
112+
is_flag=True,
113113
flag_value="decoder_dictionary.json", # Use this value when flag is used without value
114114
default=None, # No anonymization by default
115115
help="Path to the decoder dictionary file for anonymizing SQL statements",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ dependencies = [
9393
"attrs<27",
9494
"boltons<26",
9595
"cattrs<27",
96-
"click<8.2",
96+
"click<8.4",
9797
"click-aliases>=1.0.4,<2",
9898
"colorama<1",
9999
"colorlog",

tests/cfr/test_systable.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ruff: noqa: E402
2+
import importlib
23
import json
34
import os.path
45
import re
@@ -7,6 +8,7 @@
78
import tarfile
89

910
import pytest
11+
from verlib2 import Version
1012

1113
pymongo = pytest.importorskip("polars", reason="Skipping tests because polars is not installed")
1214

@@ -29,15 +31,25 @@ def filenames(path: Path):
2931
return sorted([item.name for item in path.iterdir()])
3032

3133

32-
def test_cfr_sys_export_success(cratedb, tmp_path, caplog):
34+
@pytest.fixture(scope="session")
35+
def click_kwargs():
36+
"""
37+
Click 8.2 no longer understands `mix_stderr`.
38+
"""
39+
kwargs = {}
40+
click_version = importlib.metadata.version("click")
41+
if Version(click_version) < Version("8.2"):
42+
kwargs = {"mix_stderr": False}
43+
return kwargs
44+
45+
46+
def test_cfr_sys_export_success(cratedb, click_kwargs, tmp_path, caplog):
3347
"""
3448
Verify `ctk cfr sys-export` works.
3549
"""
3650

3751
# Invoke command.
38-
runner = CliRunner(
39-
env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, mix_stderr=False
40-
)
52+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, **click_kwargs)
4153
result = runner.invoke(
4254
cli,
4355
args="--debug sys-export",
@@ -60,17 +72,15 @@ def test_cfr_sys_export_success(cratedb, tmp_path, caplog):
6072
assert len(data_files) >= 10
6173

6274

63-
def test_cfr_sys_export_to_archive_file(cratedb, tmp_path, caplog):
75+
def test_cfr_sys_export_to_archive_file(cratedb, click_kwargs, tmp_path, caplog):
6476
"""
6577
Verify `ctk cfr sys-export some-file.tgz` works.
6678
"""
6779

6880
target = os.path.join(tmp_path, "cluster-data.tgz")
6981

7082
# Invoke command.
71-
runner = CliRunner(
72-
env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, mix_stderr=False
73-
)
83+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, **click_kwargs)
7484
result = runner.invoke(
7585
cli,
7686
args=f"--debug sys-export {target}",
@@ -100,13 +110,13 @@ def test_cfr_sys_export_to_archive_file(cratedb, tmp_path, caplog):
100110
assert len(data_files) >= 10
101111

102112

103-
def test_cfr_sys_export_failure(cratedb, tmp_path, caplog):
113+
def test_cfr_sys_export_failure(cratedb, click_kwargs, tmp_path, caplog):
104114
"""
105115
Verify `ctk cfr sys-export` failure.
106116
"""
107117

108118
# Invoke command.
109-
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": "crate://foo.bar/", "CFR_TARGET": str(tmp_path)}, mix_stderr=False)
119+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": "crate://foo.bar/", "CFR_TARGET": str(tmp_path)}, **click_kwargs)
110120
result = runner.invoke(
111121
cli,
112122
args="--debug sys-export",
@@ -119,10 +129,8 @@ def test_cfr_sys_export_failure(cratedb, tmp_path, caplog):
119129
assert result.output == ""
120130

121131

122-
def test_cfr_sys_export_ensure_table_name_is_quoted(cratedb, tmp_path, caplog):
123-
runner = CliRunner(
124-
env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, mix_stderr=False
125-
)
132+
def test_cfr_sys_export_ensure_table_name_is_quoted(cratedb, click_kwargs, tmp_path, caplog):
133+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_TARGET": str(tmp_path)}, **click_kwargs)
126134
result = runner.invoke(
127135
cli,
128136
args="--debug sys-export",
@@ -178,9 +186,7 @@ def test_cfr_sys_import_success(cratedb, tmp_path, caplog):
178186
shutil.copy(sys_operations_data, data_path)
179187

180188
# Invoke command.
181-
runner = CliRunner(
182-
env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_SOURCE": str(tmp_path)}, mix_stderr=False
183-
)
189+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi, "CFR_SOURCE": str(tmp_path)})
184190
result = runner.invoke(
185191
cli,
186192
args="--debug sys-import",
@@ -200,13 +206,13 @@ def test_cfr_sys_import_success(cratedb, tmp_path, caplog):
200206
assert cratedb.database.count_records("sys-operations") == 1
201207

202208

203-
def test_cfr_sys_import_failure(cratedb, tmp_path, caplog):
209+
def test_cfr_sys_import_failure(cratedb, click_kwargs, tmp_path, caplog):
204210
"""
205211
Verify `ctk cfr sys-import` failure.
206212
"""
207213

208214
# Invoke command.
209-
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": "crate://foo.bar/", "CFR_SOURCE": str(tmp_path)}, mix_stderr=False)
215+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": "crate://foo.bar/", "CFR_SOURCE": str(tmp_path)}, **click_kwargs)
210216
result = runner.invoke(
211217
cli,
212218
args="--debug sys-import",

tests/settings/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_settings_list(cratedb, caplog):
99
"""
1010

1111
# Invoke command.
12-
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi}, mix_stderr=False)
12+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi})
1313
result = runner.invoke(
1414
cli,
1515
args="list",
@@ -26,7 +26,7 @@ def test_settings_compare(cratedb, caplog):
2626
"""
2727

2828
# Invoke command.
29-
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi}, mix_stderr=False)
29+
runner = CliRunner(env={"CRATEDB_CLUSTER_URL": cratedb.database.dburi})
3030
result = runner.invoke(
3131
cli,
3232
args="compare --no-color",

0 commit comments

Comments
 (0)