Skip to content

Commit 6c03b62

Browse files
author
github-actions
committed
fix: update trogon init_tui API and test CLI invocations
- Update init_tui() call to use new API (name parameter instead of command/help) - Update test_setup_cli.py to include 'setup' subcommand in all CLI invocations
1 parent f605ff8 commit 6c03b62

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/ryandata_address_utils/setup_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _init_trogon(app: typer.Typer) -> None:
3838
from trogon.typer import init_tui
3939
except Exception:
4040
return
41-
init_tui(app, command="tui", help="Open interactive setup UI.")
41+
init_tui(app, name="tui")
4242

4343

4444
_init_trogon(app)

tests/test_setup_cli.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_setup_cli_dry_run(monkeypatch) -> None:
1515
data_dir = Path(tmp_dir) / "libpostal-data"
1616
result = runner.invoke(
1717
setup_cli.app,
18-
[f"--data-dir={data_dir}", "--dry-run", "--yes"],
18+
["setup", f"--data-dir={data_dir}", "--dry-run", "--yes"],
1919
)
2020

2121
assert result.exit_code == 0
@@ -31,7 +31,7 @@ def test_setup_cli_check_only(monkeypatch) -> None:
3131
data_dir = Path(tmp_dir) / "libpostal-data"
3232
result = runner.invoke(
3333
setup_cli.app,
34-
[f"--data-dir={data_dir}", "--check-only", "--yes"],
34+
["setup", f"--data-dir={data_dir}", "--check-only", "--yes"],
3535
)
3636

3737
assert result.exit_code == 1 # check_only with failed check should exit 1
@@ -65,7 +65,7 @@ def fake_install(info, *, dry_run=False):
6565
data_dir = Path(tmp_dir) / "libpostal-data"
6666
result = runner.invoke(
6767
setup_cli.app,
68-
[f"--data-dir={data_dir}", "--yes", "--dry-run"],
68+
["setup", f"--data-dir={data_dir}", "--yes", "--dry-run"],
6969
)
7070

7171
assert result.exit_code == 1 # final check still fails because fake check returns False
@@ -83,7 +83,7 @@ def test_setup_cli_check_only_success(monkeypatch) -> None:
8383
data_dir = Path(tmp_dir) / "libpostal-data"
8484
result = runner.invoke(
8585
setup_cli.app,
86-
[f"--data-dir={data_dir}", "--check-only", "--yes"],
86+
["setup", f"--data-dir={data_dir}", "--check-only", "--yes"],
8787
)
8888

8989
assert result.exit_code == 0
@@ -141,7 +141,7 @@ def fake_check(data_dir):
141141
data_dir = Path(tmp_dir) / "libpostal-data"
142142
result = runner.invoke(
143143
setup_cli.app,
144-
[f"--data-dir={data_dir}", "--yes"],
144+
["setup", f"--data-dir={data_dir}", "--yes"],
145145
)
146146

147147
assert result.exit_code == 0
@@ -174,7 +174,7 @@ def fake_default_data_dir(info):
174174
monkeypatch.setattr(setup_cli, "ensure_postal_binding", lambda **k: None)
175175

176176
with runner.isolated_filesystem():
177-
result = runner.invoke(setup_cli.app, ["--dry-run"])
177+
result = runner.invoke(setup_cli.app, ["setup", "--dry-run"])
178178

179179
assert result.exit_code == 0
180180
assert prompt_calls # prompt was used
@@ -190,7 +190,7 @@ def test_setup_cli_final_failure(monkeypatch, tmp_path: Path) -> None:
190190

191191
result = runner.invoke(
192192
setup_cli.app,
193-
[f"--data-dir={tmp_path}", "--yes", "--dry-run"],
193+
["setup", f"--data-dir={tmp_path}", "--yes", "--dry-run"],
194194
)
195195

196196
assert result.exit_code == 1
@@ -211,7 +211,7 @@ def test_setup_cli_existing_data_redownload(monkeypatch, tmp_path: Path) -> None
211211

212212
result = runner.invoke(
213213
setup_cli.app,
214-
[f"--data-dir={tmp_path}", "--dry-run"],
214+
["setup", f"--data-dir={tmp_path}", "--dry-run"],
215215
)
216216

217217
assert result.exit_code == 0

0 commit comments

Comments
 (0)