Skip to content

Store a timing.Duration in CallInfo - #15298

Merged
RonnyPfannschmidt merged 1 commit into
pytest-dev:mainfrom
RonnyPfannschmidt:callinfo-duration
Oct 30, 2026
Merged

RonnyPfannschmidt merged 1 commit into
pytest-dev:mainfrom
RonnyPfannschmidt:callinfo-duration

Conversation

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

CallInfo keeps the measured timing.Duration; start, stop and duration are properties derived from it (still assignable, as plugins such as pytest-asyncio-cooperative set them).

All construction sites measure with _pytest.timing. Subtests used time.time()/time.perf_counter() directly, so a test mocking time under subtests.test() got negative or bogus durations. unittest subtests, which come without timing, use the named timing.UNMEASURED (zeros, as before).

Fixes #15201

CallInfo keeps the measured timing.Duration; start, stop and duration
are properties derived from it (still assignable, as plugins such as
pytest-asyncio-cooperative set them).

All construction sites measure with _pytest.timing. Subtests used
time.time()/time.perf_counter() directly, so a test mocking time under
subtests.test() got negative or bogus durations. unittest subtests,
which come without timing, use the named timing.UNMEASURED (zeros, as
before).

Fixes pytest-dev#15201.

Co-Authored-By: Claude Opus 5.5 via Claude Code <noreply@anthropic.com>

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, LGTM

@RonnyPfannschmidt
RonnyPfannschmidt merged commit 0212785 into pytest-dev:main Oct 30, 2026
36 checks passed
@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

@bluetech i think we need to iterate a bit on authorship/review we want to see

i have been pushing driving a claude project from my phone to deal with reviews/issues recently - and i might have slightly overdone it

i'd like to align it a bit so i can make use of the agent from mobile as its quite a time safer to run those things quicky
but the last pr that i jut closed also demonstrated that more steering/change is needed than i currently apply - and it seems recently its getting a bit more thats needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subtest durations become negative when time is mocked (subtests.py bypasses _pytest.timing)

2 participants