Skip to content

Add support for .coveragerc.toml #1222

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

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

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

@nathanjmcdougall nathanjmcdougall commented Dec 23, 2025

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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

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
Copy link
Copy Markdown

codspeed-hq bot commented Dec 23, 2025

CodSpeed Performance Report

Merging #1222 will not alter performance

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

Summary

✅ 2 untouched

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 23, 2025

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