Skip to content

test(cli): fix the healthcheck tests for Typer 0.29 - #571

Merged
jsenecal merged 1 commit into
mainfrom
fix/cli-tests-click-85
Nov 21, 2026
Merged

jsenecal merged 1 commit into
mainfrom
fix/cli-tests-click-85

Conversation

@jsenecal

@jsenecal jsenecal commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

main CI has been red since #535 merged (run 44912884609):

ERROR hyperglass/cli/tests/test_healthcheck.py - TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!

#524 added test_healthcheck.py with CliRunner(mix_stderr=False). #535 lifted the Typer hold to 0.29.2. That version ships its own typer.testing.CliRunner, whose signature is (charset, env), so the argument raises at import. Both PRs were green on their own, and the break only appears once both are on main.

The collection error also hid a second failure: test_help.py::test_commands_cover_cli requires every registered command to be in COMMANDS, and #524's healthcheck wasn't.

Change

  • test_healthcheck.py: CliRunner(). healthcheck prints only to stdout through echo.success / echo.error, and the tests assert exit codes, so mix_stderr=False never affected them. No mix_stderr remains in the repo.
  • test_help.py: add ("healthcheck",) to COMMANDS.

Tests

$ .venv/bin/pytest hyperglass/cli -q
61 passed
$ .venv/bin/pytest hyperglass --ignore hyperglass/plugins/external -q
4225 passed, 4 skipped
$ .venv/bin/ruff check hyperglass/cli
All checks passed!

Notes

  • Every open PR's CI fails until this merges, because they all run against main.
  • Follow-up, not done here: test_unhealthy and test_unreachable only assert exit_code == 1, so they can't tell their branches apart. Asserting short substrings of result.stdout would make them stronger.

Closes #572

Typer 0.29 ships its own CliRunner, which takes only charset and env, so CliRunner(mix_stderr=False) in test_healthcheck.py raised TypeError at collection once #535 lifted the Typer hold, and main's CI broke. The healthcheck command prints only to stdout and the tests check exit codes, so a plain CliRunner() is enough. That collection error also hid test_help.py::test_commands_cover_cli, which fails because COMMANDS lacked healthcheck (#524); it is added.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 86.156% (+0.3%) from 85.887% — fix/cli-tests-click-85 into main

@WilhelmZA WilhelmZA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 14e6ecef.

The change is correct. CliRunner() drops the mix_stderr argument that the runner no longer accepts, and healthcheck is added to COMMANDS so test_commands_cover_cli matches the registered commands. No mix_stderr is left in the tree. The branch contains current main (b9517a39), CI gate passes on it, both backend jobs included, and the commit is verified.

Before approval:

  • The body has no Closes #n or Part of #n. Please open an issue for the red CI on main since #535 and link it with Closes. No new commit is needed; I will approve this head once the link is in the body.

@WilhelmZA WilhelmZA added the reviewing Issue is being reviewed by maintainers label Nov 21, 2026
@jsenecal

Copy link
Copy Markdown
Collaborator Author

Opened #572 for the red CI on main and added Closes #572 to the body. No new commit.

@WilhelmZA WilhelmZA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving at 14e6ecef.

The body now closes #572. The change is as reviewed: CliRunner() without mix_stderr, and healthcheck added to COMMANDS. The branch contains current main (b9517a39), CI gate passes on it with both backend jobs, and the commit is verified.

The other open PRs need a rebase onto main after this merges, because their CI gate fails on the same collection error.

@jsenecal
jsenecal merged commit f89ab22 into main Nov 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python backend: API, models, state, execution reviewing Issue is being reviewed by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI fails on main: healthcheck tests pass mix_stderr to Typer 0.29's CliRunner

3 participants