Skip to content

Add support for .coveragerc.toml #1222

Merged
nathanjmcdougall merged 3 commits into
mainfrom
1173-support-coveragerctoml-files
Dec 23, 2025
Merged

Add support for .coveragerc.toml #1222
nathanjmcdougall merged 3 commits into
mainfrom
1173-support-coveragerctoml-files

Conversation

@nathanjmcdougall

@nathanjmcdougall nathanjmcdougall commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

…er `pyproject.toml` instead of `.coveragerc`
@nathanjmcdougall nathanjmcdougall linked an issue Dec 23, 2025 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for .coveragerc.toml as a configuration file for Coverage.py, positioning it as the fallback preference after pyproject.toml but before .coveragerc. The change enables TOML-based configuration for Coverage.py in projects that don't use pyproject.toml.

Key changes:

  • Introduced CoverageRCTOMLManager class to handle .coveragerc.toml files
  • Updated file preference order: pyproject.toml.coveragerc.toml.coveragerc
  • Added comprehensive test coverage for the new file format and priority logic
  • Bumped Ruff version from v0.14.9 to v0.14.10

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/usethis/_config_file.py Adds CoverageRCTOMLManager class and registers it in files_manager()
src/usethis/_tool/impl/coverage_py.py Updates preferred file manager to return CoverageRCTOMLManager as fallback and adds .coveragerc.toml entries to all configuration items
tests/usethis/_tool/impl/test_coverage_py.py Adds three new test cases validating .coveragerc.toml behavior and file priority logic
src/usethis/_tool/impl/ruff.py Bumps Ruff version to v0.14.10

Comment thread src/usethis/_tool/impl/coverage_py.py
Comment thread tests/usethis/_tool/impl/test_coverage_py.py
I realized this is probably unwise since this won't be available in older versions of `Coverage.py` and so this might be too soon from an ecosystem perspective.

I think this is also worth making a separate ticket to discuss in more detail because the design is a bit flimsy here
@codspeed-hq

codspeed-hq Bot commented Dec 23, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #1222 will not alter performance

Comparing 1173-support-coveragerctoml-files (0586f74) with main (bd8730f)

Summary

✅ 2 untouched

@codecov

codecov Bot commented Dec 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@nathanjmcdougall nathanjmcdougall merged commit c92d31e into main Dec 23, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 1173-support-coveragerctoml-files branch December 23, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support .coveragerc.toml files

2 participants