feat[cli]: Use nice cli
Test and coverage / build (push) Failing after 55s

This commit is contained in:
2026-06-28 01:45:14 +03:00
parent 998665a4bf
commit 846ac52854
4 changed files with 52 additions and 14 deletions
+34 -4
View File
@@ -96,16 +96,46 @@ def test_main_returns_failure_for_invalid_config(monkeypatch):
monkeypatch.setattr(cli, "read_toml_config", fake_read_toml_config)
assert cli.main(["bad.toml"]) == 1
assert cli.main(["--config", "bad.toml"]) == 1
def test_main_uses_config_path(monkeypatch, tmp_path):
def test_main_uses_config_option(monkeypatch, tmp_path):
config = make_config(tmp_path)
calls = []
paths = []
monkeypatch.setattr(cli, "read_toml_config", lambda path: config)
def fake_read_toml_config(path):
paths.append(path)
return config
monkeypatch.setattr(cli, "read_toml_config", fake_read_toml_config)
monkeypatch.setattr(cli, "setup_logging", lambda logging_config: None)
monkeypatch.setattr(cli, "run", lambda config: calls.append(config) or 0)
assert cli.main(["config.toml"]) == 0
assert cli.main(["--config", "config.toml"]) == 0
assert paths == ["config.toml"]
assert calls == [config]
def test_main_requires_config_option(capsys):
try:
cli.main([])
except SystemExit as err:
assert err.code == 2
else:
raise AssertionError("expected SystemExit")
assert "error:" in capsys.readouterr().err
def test_main_rejects_positional_config(capsys):
try:
cli.main(["config.toml"])
except SystemExit as err:
assert err.code == 2
else:
raise AssertionError("expected SystemExit")
stderr = capsys.readouterr().err
assert "error:" in stderr
assert "--config" in stderr