Skip to content

add tui#117

Open
15168316096 wants to merge 1 commit intomainfrom
tui-test
Open

add tui#117
15168316096 wants to merge 1 commit intomainfrom
tui-test

Conversation

@15168316096
Copy link
Collaborator

add tui test

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new integration test suite to validate the RPC/TCP interfaces that ckb-tui relies on, and extends the Python RPC client with a get_overview helper for the Terminal RPC module.

Changes:

  • Add test_cases/ckb-tui/test_ckb_tui.py covering RPC dependencies, TCP subscriptions, and basic ckb-tui binary start/exit behavior.
  • Add RPCClient.get_overview() to call the Terminal module’s get_overview RPC.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
test_cases/ckb-tui/test_ckb_tui.py New test suite for ckb-tui RPC deps, TCP subscriptions, and binary smoke checks.
framework/rpc.py Adds a get_overview RPC wrapper used by the new tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@classmethod
def setup_class(cls):
if not os.path.isfile(CKB_TUI_BIN):
pytest.skip("ckb-tui binary not found, run ckb_tui_prepare.sh first")
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestCkbTuiBinary skips the entire class when the ckb-tui binary is missing. There doesn't appear to be any build/download step in the repository that places source/ckb-tui/ckb-tui during make prepare, so in CI this suite may silently skip and not validate the binary integration. Consider adding a prepare step that builds/downloads ckb-tui, or converting these into explicit xfail/marker-gated tests so CI coverage is intentional.

Suggested change
pytest.skip("ckb-tui binary not found, run ckb_tui_prepare.sh first")
pytest.xfail("ckb-tui binary not found, run ckb_tui_prepare.sh first")

Copilot uses AI. Check for mistakes.
Comment on lines +347 to +350
time.sleep(3)
poll = proc.poll()
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
proc.wait(timeout=5)
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The process group is terminated unconditionally via os.killpg(...) even if proc.poll() indicates the process already exited. If ckb-tui exits early, killpg can raise ProcessLookupError and fail the test before the intended assertion. Only send signals when poll is None, and add a fallback (e.g., SIGKILL) if the process doesn't exit within the timeout.

Copilot uses AI. Check for mistakes.
Comment on lines +368 to +371
time.sleep(3)
poll = proc.poll()
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
proc.wait(timeout=5)
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same termination pattern as above: os.killpg(...) is called regardless of whether the process already exited, which can raise and make the test flaky. Gate the signal-sending on proc.poll() is None, and handle TimeoutExpired to avoid leaving orphaned processes.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +13
CKB_TUI_BIN = f"{get_project_root()}/source/ckb-tui/ckb-tui"
TCP_PORT = 18314

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new test suite is added under test_cases/ckb-tui, but the repo's make test runner iterates only over the test_cases := ... list in Makefile, which currently does not include this directory. As a result, these tests likely won't run in CI unless the Makefile (or CI test selection) is updated to include test_cases/ckb-tui.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants