Skip to content

test(cli): add fallback-queue navigation command tests (#1188)#1192

Open
microsasa wants to merge 1 commit intomainfrom
test/interactive-fallback-navigation-1188-e49a31bd39b51872
Open

test(cli): add fallback-queue navigation command tests (#1188)#1192
microsasa wants to merge 1 commit intomainfrom
test/interactive-fallback-navigation-1188-e49a31bd39b51872

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Add TestInteractiveLoopFallbackNavigation class with four tests verifying that navigation commands delivered via the builtins.input fallback queue are handled identically to the normal _read_line_nonblocking path.

Tests added

Test Scenario
test_cost_command_via_fallback 'c' via fallback shows cost view
test_refresh_command_via_fallback 'r' via fallback refreshes home view
test_session_number_via_fallback Valid session number opens detail view
test_unknown_command_via_fallback Unrecognised command prints "Unknown command"

All tests monkeypatch _read_line_nonblocking to raise ValueError (triggering the threaded fallback) and supply commands via builtins.input, then assert the same output as the normal stdin path.

Notes

  • make fix && make check could not run in this environment due to PyPI being blocked by the network firewall. The test file passes Python AST parsing and follows the exact conventions of adjacent fallback tests (lines 2177–2270).

Closes #1188

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pypi.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pypi.org"

See Network Configuration for more information.

Generated by Issue Implementer · ● 11.8M ·

Add TestInteractiveLoopFallbackNavigation class verifying that navigation
commands ('c', 'r', session number, unknown command) delivered via the
builtins.input fallback are handled identically to the normal
_read_line_nonblocking path.

Closes #1188

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 10:53
@microsasa microsasa added the aw Created by agentic workflow label May 5, 2026
@microsasa microsasa enabled auto-merge May 5, 2026 10:53
Copy link
Copy Markdown

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 fallback-path interactive CLI tests so commands supplied through the builtins.input reader thread are exercised alongside the existing _read_line_nonblocking coverage in copilot_usage.cli.

Changes:

  • Adds a new TestInteractiveLoopFallbackNavigation test class for fallback-path navigation commands.
  • Covers fallback handling for cost view, refresh, numeric session selection, and unknown commands.
  • Extends the interactive CLI regression suite around Windows/non-selectable-stdin behavior.

Comment on lines +2295 to +2300
call_count = iter(commands)

def _fake_input(*_a: str, **_kw: str) -> str:
return next(call_count)

monkeypatch.setattr("builtins.input", _fake_input)
Comment on lines +2314 to +2323
def test_refresh_command_via_fallback(
self, tmp_path: Path, monkeypatch: Any
) -> None:
"""'r' via fallback refreshes home view without crashing."""
_write_session(tmp_path, "fb-cmd-r0-0000-0000-0000-0000", name="RefFb")
import copilot_usage.cli as cli_mod

self._patch_fallback(monkeypatch, cli_mod, ["r", "q"])
result = CliRunner().invoke(main, ["--path", str(tmp_path)])
assert result.exit_code == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][test audit] _interactive_loop fallback-queue path: navigation commands ('c', 'r', session number) untested

2 participants