Skip to content

test(sdk/python): Click CliRunner suite for the CLI (bounty #17181) - #8686

Open
leettlest wants to merge 1 commit into
Scottcjn:mainfrom
leettlest:sdk-python-cli-tests-17181
Open

leettlest wants to merge 1 commit into
Scottcjn:mainfrom
leettlest:sdk-python-cli-tests-17181

Conversation

@leettlest

Copy link
Copy Markdown

Summary

Adds sdk/python/tests/test_cli.py — an offline Click CliRunner suite covering every documented command and option of the Python SDK CLI — plus sdk/python/requirements-dev.txt (declares pytest/respx/httpx/click/cryptography) and a minimal .github/workflows/sdk-python.yml (3.9/3.11/3.13; no existing workflow covers sdk/python). No SDK source changes.

Linking Scottcjn/rustchain-bounties#17181.

pytest output (local, fully offline, all HTTP mocked with respx):

======================= 50 passed, 10 xfailed in ~2s ========================

Command → test-name mapping (cargo test-style; all via invoke() with --node https://node.test)

CLI path Tests
rustchain --help / --version test_help_and_version[--help], [--version]
wallet --help … attest --help (all groups/leaves) test_help_and_version[<cmd>] (11 parametrized)
wallet create (default / --words 24 / --json / --words 13 rejected) test_wallet_create_default_human, test_wallet_create_words_24_human, test_wallet_create_json_parses_and_has_keys, test_wallet_create_json_24_words, test_wallet_create_invalid_words_rejected
wallet balance <addr> (--node, --json, human; 400/500/unreachable; canonical xfail #8580) test_balance_human, test_balance_json, test_balance_unreachable_node, test_balance_http_500_exits_nonzero_with_stderr, test_balance_http_400_exits_nonzero_with_message, test_balance_canonical_amount_rtc_field
wallet send <from> <to> <amount> (--fee, --seed, --node, --json) test_send_success_human, test_send_success_json, test_send_payload_fields_include_chain_and_signature, test_send_address_mismatch_exits_nonzero, test_send_amount_abc_rejected, test_send_amount_negative_rejected, test_send_amount_zero_rejected (xfail), test_send_unreachable_node, test_send_transfer_http_400_exits_nonzero, test_send_missing_seed_exits_nonzero, test_send_fractional_amount_reaches_transfer (xfail #8564), test_send_fractional_fee_reaches_transfer (xfail #8564), test_send_amount_and_fee_are_exact_decimals (xfail #8618), test_send_excess_precision_rejected
node (--node, --json; unreachable/500/non-JSON-200 xfail; #8565 xfail) test_node_human, test_node_json, test_node_unreachable, test_node_http_500_exits_nonzero, test_node_non_json_200_is_an_error (xfail), test_node_status_documented_invocation (xfail #8565)
epoch (same shape) test_epoch_human, test_epoch_json, test_epoch_unreachable, test_epoch_http_500_exits_nonzero, test_epoch_non_json_200_is_an_error (xfail), test_epoch_info_documented_invocation (xfail #8565)
miners list (--json, wrapped-envelope normalization, unreachable/500) test_miners_list_human, test_miners_list_json, test_miners_list_accepts_wrapped_payload, test_miners_list_unreachable, test_miners_list_http_500_exits_nonzero
attest <addr> (--seed, --node, --json; mismatch/unreachable/missing-seed/submit-400; full flow; #8566 xfail) test_attest_human_full_flow, test_attest_address_mismatch_exits_nonzero, test_attest_unreachable_node, test_attest_missing_seed_exits_nonzero, test_attest_submit_http_400_exits_nonzero, test_attest_json_output_is_parseable_json, test_attest_json_runs_full_flow (xfail #8566)

Notes on #8618 (representation)

The issue specifies exact-decimal serialization but not the wire representation; tests here therefore (a) keep the parser-gate xfail, (b) assert the amount binds byte-for-byte as the 0.1 literal in the raw request body, and (c) add test_send_excess_precision_rejected (0.1234567 must exit non-zero — today only via the #8564 parser gate; a float-parsing band-aid would turn it red; a max-decimals guard per #8618's suggestion keeps it green). Coordinating the exact representation is explicitly left to the #8618 fix.

How to verify

python -m pip install -e sdk/python -r sdk/python/requirements-dev.txt
python -m pytest sdk/python/tests/test_cli.py -v
# optional, flips the strict xfails to failures:
python -m pytest sdk/python/tests/test_cli.py --runxfail

No file outside sdk/python/tests/, sdk/python/requirements-dev.txt, and .github/workflows/sdk-python.yml is modified.

@leettlest
leettlest requested a review from Scottcjn as a code owner November 12, 2026 08:52
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci size/XL PR: 500+ lines labels Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR is quite large (XL). Consider splitting into smaller, focused PRs for faster review. Large PRs take longer to review and have higher risk of issues.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci size/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant