Repository navigation
Fix node duration formatting when rounding crosses a unit boundary - #15145
Open
RonnyPfannschmidt wants to merge 1 commit into
Open
RonnyPfannschmidt wants to merge 1 commit into
RonnyPfannschmidt wants to merge 1 commit into
Conversation
Member
Author
|
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it. Why not use a library for this formatting? I checked the two common ones against the boundary values from the new tests:
So the PR keeps the hand-written Generated by Claude Code |
``format_node_duration`` picked the unit before rounding, so a duration such as 0.99996ms was shown as ``1000.0us`` instead of ``1.000ms`` (and 59.9996s as ``0m 60s``). This made ``TestProgressOutputStyle::test_times`` fail intermittently on fast CI runners. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VzXq7WcB4fSibrBDvLFXAQ
RonnyPfannschmidt
force-pushed
the
claude/project-thread-0ll2wg
branch
from
October 6, 2026 14:06
a698a77 to
3212d47
Compare
RonnyPfannschmidt
marked this pull request as ready for review
October 6, 2026 14:06
This branch has not been deployed
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.
Requested by Ronny · project thread
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
Merge strategy: squash.
Before: with
console_output_style = times, a duration just under a unit boundary was printed with too many digits, e.g. 0.99996ms as1000.0usand 59.9996s as0m 60s.TestProgressOutputStyle::test_timesfailed on main because of this (windows-py311 job, outputtest_foo.py ..... 1000.0us).After: the same durations print as
1.000msand1m 0s.How:
format_node_durationnow formats the value first and only keeps a unit if the rounded number stays below that unit's limit, otherwise it moves to the next one. Minutes and hours are computed from the rounded whole seconds. New parametrized cases cover each boundary; all of them fail on main.No library was used:
humanizeandhumanfriendlyproduce long-form text ("999 milliseconds and 960 microseconds"), not the compact at-most-7-character column this output needs, andhumanfriendly.format_timespan(59.9996)has the same rounding issue ("60 seconds").Co-authored-bytrailer