test: add multi-model pure-active and shutdown_only coverage (#1189)#1193
Open
test: add multi-model pure-active and shutdown_only coverage (#1189)#1193
Conversation
…_only on pure-active sessions Add two tests addressing coverage gaps identified in #1189: 1. test_cost_view_multi_model_pure_active: verifies that a pure-active session with two models shows '—' for both model rows' Requests and Premium Cost columns, and that grand totals don't inflate from synthetic zeros. 2. test_shutdown_only_no_effect_for_pure_active_session: verifies that _compute_session_totals with shutdown_only=True returns full totals (not subtracted) for pure-active sessions where has_shutdown_metrics is False. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted regression tests in test_report.py to cover two pure-active session edge cases in reporting logic, strengthening confidence around cost rendering and shutdown-only totals in the CLI reporting layer.
Changes:
- Added a
render_cost_viewtest for a multi-model pure-active session to verify per-model—display, correct grand totals, and absence of the shutdown sub-row. - Added a
_compute_session_totals(..., shutdown_only=True)test confirming pure-active sessions do not subtract active counters whenhas_shutdown_metrics=False.
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.
Closes #1189
Summary
Adds two tests addressing test coverage gaps identified in the issue:
Gap 1 —
render_cost_viewmulti-model pure-active sessiontest_cost_view_multi_model_pure_activeverifies that a pure-active session with two models inmodel_metrics:'—'in Requests and Premium Cost columns for both model rows'↳ Since last shutdown'sub-row appearsGap 2 —
_compute_session_totalspure-active withshutdown_only=Truetest_shutdown_only_no_effect_for_pure_active_sessionverifies that whenshutdown_only=Trueis passed for a pure-active session (has_shutdown_metrics=False):model_callsreturns the full total (8, not 8−5=3)user_messagesreturns the full total (4, not 4−2=2)The subtraction branch requires
has_shutdown_metrics=True, so pure-active sessions should pass through unchanged.Testing
Both tests follow the exact spec from the issue and are placed in their respective test classes (
TestRenderCostViewPureActiveNoShutdownRowandTestComputeSessionTotals).Warning
The following domains were blocked by the firewall during workflow execution:
astral.shindex.crates.iopypi.orgreleaseassets.githubusercontent.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.