test(cli): add fallback-queue navigation command tests (#1188)#1192
Open
test(cli): add fallback-queue navigation command tests (#1188)#1192
Conversation
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>
There was a problem hiding this comment.
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
TestInteractiveLoopFallbackNavigationtest 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
TestInteractiveLoopFallbackNavigationclass with four tests verifying that navigation commands delivered via thebuiltins.inputfallback queue are handled identically to the normal_read_line_nonblockingpath.Tests added
test_cost_command_via_fallback'c'via fallback shows cost viewtest_refresh_command_via_fallback'r'via fallback refreshes home viewtest_session_number_via_fallbacktest_unknown_command_via_fallbackAll tests monkeypatch
_read_line_nonblockingto raiseValueError(triggering the threaded fallback) and supply commands viabuiltins.input, then assert the same output as the normal stdin path.Notes
make fix && make checkcould 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
The following domain was blocked by the firewall during workflow execution:
pypi.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.