forked from lei.chen/myxce
feat(admin-config-tool): task 1.1 - xceadmin package skeleton
Editable-installable xceadmin package with a real click-group entry point (zero subcommands yet) and xcecommon as an independently importable standalone package. Requirements: 5.4
This commit is contained in:
parent
4ad31d774d
commit
b30a856a2d
6 changed files with 248 additions and 0 deletions
44
src/xceadmin/tests/test_cli.py
Normal file
44
src/xceadmin/tests/test_cli.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"""Tests for the xceadmin package skeleton (task 1.1).
|
||||
|
||||
Covers Requirement 5.4: xcecommon is importable as a standalone package
|
||||
independent of xceadmin's CLI, and the xceadmin console-script entry point
|
||||
is backed by a genuinely working (if currently empty) click group.
|
||||
"""
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
from xceadmin.cli import cli
|
||||
|
||||
|
||||
def test_cli_help_exits_zero() -> None:
|
||||
"""`xceadmin --help` must run cleanly and print usage text."""
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["--help"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "Usage:" in result.output
|
||||
|
||||
|
||||
def test_cli_help_shows_zero_commands() -> None:
|
||||
"""The click group has no subcommands yet (config build/push land later)."""
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["--help"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "Commands:" not in result.output
|
||||
|
||||
|
||||
def test_cli_group_invoked_with_no_args_does_not_traceback() -> None:
|
||||
"""Invoking the bare group with no subcommand exits cleanly via click's
|
||||
own SystemExit (no subcommand registered yet), not an unhandled
|
||||
traceback from application code."""
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, [])
|
||||
|
||||
assert isinstance(result.exception, SystemExit)
|
||||
assert "Usage:" in result.output
|
||||
|
||||
|
||||
def test_xcecommon_is_importable_independent_of_xceadmin() -> None:
|
||||
"""xcecommon must be importable on its own, with no xceadmin import."""
|
||||
import xcecommon # noqa: F401 - import success is the assertion
|
||||
Loading…
Add table
Add a link
Reference in a new issue