Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pyproject.toml to override a global coveragerc #1723

Open
crazystick opened this issue Dec 21, 2023 · 0 comments
Open

Allow pyproject.toml to override a global coveragerc #1723

crazystick opened this issue Dec 21, 2023 · 0 comments
Labels
enhancement New feature or request needs triage

Comments

@crazystick
Copy link

Is your feature request related to a problem? Please describe.
I maintain a docker image which is used for testing multiple different projects, and I'd like to provide a set of global defaults for coverage but be able to override them per project in pyproject.toml

Describe the solution you'd like
I would like config to be loaded first from a global default file, e.g. /etc/coveragerc which would replace any defaults from CoverageConfig. After this the existing logic which reads the various configuration files (and exits as soon as it finds a valid one) will still work fine. I also believe this implementation will not break existing configurations.

Describe alternatives you've considered
I tried passing config directly on the command line and via a specified config file, but because read_coverage_config breaks as soon as it finds the first valid configuration file, it didn't work.

It could be possible to just remove the early exit in read_coverage_config but that would potentially break people's existing configuration.

Additional context
The main thing I'd like to specify in the global defaults is fail_under - I would like to have a target that is organisation wide, and anyone configuring a different value via a pyproject.toml would be a red flag. Sometimes it's just not practical to hit the target though.

@crazystick crazystick added enhancement New feature or request needs triage labels Dec 21, 2023
@crazystick crazystick changed the title Allow pyproject.toml to override coveragerc Allow pyproject.toml to override a global coveragerc Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

1 participant