Skip to content

gh-152409: Save the trace --file counts when --no-report is used#152410

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:cpy-trace-norep
Open

gh-152409: Save the trace --file counts when --no-report is used#152410
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:cpy-trace-norep

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

python -m trace --count --no-report --file FILE now saves the counts to
FILE, so counts can be accumulated over several runs — which is what
--file and --no-report are documented to support.

The counts were pickled only at the end of
CoverageResults.write_results(), which main() skips when --no-report
is given, so --no-report --file silently discarded them. This extracts
that step into CoverageResults.save_counts() (still called from
write_results() exactly as before) and also calls it on the
--no-report branch.

save_counts() only writes when --file was given (it is a no-op
otherwise), and a --file run without --no-report already wrote the
file for every mode, so the two paths are now consistent.

The counts were only persisted at the end of CoverageResults.write_results(),
which main() skips when --no-report is given, so --no-report --file silently
discarded them.  Move that step into CoverageResults.save_counts() (still
called from write_results()) and call it on the --no-report branch too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant