Skip to content

test(sdk): add Click CliRunner test suite for all Python SDK CLI commands (#17181) - #8674

Closed
satoshinakamoto666666 wants to merge 1 commit into
Scottcjn:mainfrom
satoshinakamoto666666:test/python-sdk-cli-clirunner-17181
Closed

satoshinakamoto666666 wants to merge 1 commit into
Scottcjn:mainfrom
satoshinakamoto666666:test/python-sdk-cli-clirunner-17181

Conversation

@satoshinakamoto666666

@satoshinakamoto666666 satoshinakamoto666666 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #17181
Closes #17181
Fixes Scottcjn/rustchain-bounties#17181
Closes Scottcjn/rustchain-bounties#17181

Refs #8564, #8565, #8566, #8580, #8618

Summary

Rebased onto origin/main (499e43b6) and fixed CI test-cli:

  • .github/workflows/python-sdk-cli-tests.yml: Uses actions/checkout@v7 and actions/setup-python@v6, installs ./sdk/python[dev] (resolving ModuleNotFoundError: No module named 'httpx'), and runs test_cli.py + test_amounts.py.
  • sdk/python/tests/test_cli.py: Offline Click CliRunner test suite using httpx.MockTransport (# SPDX-License-Identifier: MIT).

Command -> Test Mapping Table(paste into PR #8674 description)

CLI Command / Option Test Function(s)
rustchain --help, --version test_all_commands_help_and_version
wallet --help, `create balance
wallet create (--words 12, --words 24, --json, invalid --words 15) test_wallet_create_12_and_24_words_human_and_json, test_wallet_create_invalid_word_count_exits_nonzero
wallet balance ADDRESS (--node, --json, 4xx/5xx, unreachable, missing ADDRESS, canonical amount_rtc #8580) test_wallet_balance_human_json_and_node_option, test_unreachable_node_exits_nonzero_on_stderr, test_http_4xx_5xx_exits_nonzero_on_stderr_without_traceback, test_wallet_send_bad_address_bad_amounts_and_missing_options, test_regression_8580_balance_reads_canonical_amount_rtc_field
wallet send FROM TO AMOUNT (--fee, --seed, --node, --json, bad address, abc/0/negative/--fee -1, missing args/--seed, #8564, #8618) test_wallet_send_human_json_node_and_exact_micro_rtc_payload, test_wallet_send_bad_address_bad_amounts_and_missing_options, test_regression_8564_fractional_amount_accepted, test_regression_8618_no_float_money_serialization
node (--node, --json, unreachable, 4xx/5xx, non-JSON 200, #8565 node status) test_node_epoch_and_miners_list_commands_and_node_option, test_unreachable_node_exits_nonzero_on_stderr, test_http_4xx_5xx_exits_nonzero_on_stderr_without_traceback, test_non_json_200_never_crashes_with_traceback, test_non_json_200_exits_nonzero_with_stderr_error, test_regression_8565_readme_subcommands_node_status_and_epoch_info
epoch (--node, --json, unreachable, 4xx/5xx, non-JSON 200, #8565 epoch info) test_node_epoch_and_miners_list_commands_and_node_option, test_unreachable_node_exits_nonzero_on_stderr, test_http_4xx_5xx_exits_nonzero_on_stderr_without_traceback, test_non_json_200_never_crashes_with_traceback, test_regression_8565_readme_subcommands_node_status_and_epoch_info
miners --help, miners list (--node, --json, unreachable, 4xx/5xx, non-JSON 200) test_all_commands_help_and_version, test_node_epoch_and_miners_list_commands_and_node_option, test_unreachable_node_exits_nonzero_on_stderr, test_http_4xx_5xx_exits_nonzero_on_stderr_without_traceback, test_non_json_200_never_crashes_with_traceback
attest WALLET_ADDRESS (--seed, --node, unreachable, 4xx/5xx, missing args/--seed, #8566 --json) test_attest_human_flow_with_node_option, test_unreachable_node_exits_nonzero_on_stderr, test_http_4xx_5xx_exits_nonzero_on_stderr_without_traceback, test_wallet_send_bad_address_bad_amounts_and_missing_options, test_regression_8566_attest_json_actually_submits_attestation

Local Verification Output

  • python -m ruff check sdk/python/tests/test_cli.py -> All checks passed!
  • python tools/falsegreen/falsegreen.py --min-sev HIGH sdk/python/tests/test_cli.py -> 0 finding(s) (0 HIGH, 0 MED) across 1 files
  • python -m py_compile sdk/python/tests/test_cli.py -> exit 0
  • pytest sdk/python/tests/test_cli.py -v -> 24 passed, 6 xfailed in 0.26s (6 xfailed are strict xfail(strict=True) regression specs for unmerged upstream bugs #8564, #8565, #8566, #8580, #8618 wire path blocked by #8564, and non-JSON 200 raw_response exit-0 fallback).
  • pytest sdk/python/rustchain_sdk/tests/test_amounts.py -v -> 48 passed in 0.09s

Wallet: RTCfe0ac752b80e543048c0d91e7dddd1277678b8a5
Beacon Agent ID: bcn_fe0ac752b80e

@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 size/L PR: 201-500 lines BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) ci labels Nov 11, 2026
@satoshinakamoto666666
satoshinakamoto666666 force-pushed the test/python-sdk-cli-clirunner-17181 branch from b65ed9f to 499e43b Compare November 24, 2026 02:45
@satoshinakamoto666666

Copy link
Copy Markdown
Contributor Author

Rebased onto main (499e43b6) and updated .github/workflows/python-sdk-cli-tests.yml to install ./sdk/python[dev] (fixing ModuleNotFoundError: No module named 'httpx'). Verified 72 passed, 6 xfailed locally, ruff clean, and falsegreen 0 HIGH findings.

Wallet: RTCfe0ac752b80e543048c0d91e7dddd1277678b8a5

@Scottcjn

Copy link
Copy Markdown
Owner

Thank you for the submission. This is the same change as the earlier open PR #8661, so I'm closing this one as a duplicate. If yours handles a case #8661 misses, name the case and we will reopen it.

@Scottcjn Scottcjn closed this Nov 27, 2026
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/L PR: 201-500 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOUNTY: 15 RTC] Python SDK CLI has zero tests — add a Click CliRunner suite for every command (wallet/node/epoch/miners/attest)

2 participants