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
Add support for coverage config file (.coveragerc) #10289
Conversation
still working on adding more tests |
bd22f99
to
b67a4bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff... just nits. Thanks!
type=file_option, | ||
default=None, | ||
advanced=True, | ||
help="Path to `.coveragerc` or alternative coverage config file", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"alternative coverage config file"
I'm not sure what this means... does it mean something like "or other file in the .coveragerc
format"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wording comes from the other subsystems. It's meant to say that it could for example be pyproject.toml
. See all the options they have at https://coverage.readthedocs.io/en/coverage-5.2/config.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Thanks Asher!
type=file_option, | ||
default=None, | ||
advanced=True, | ||
help="Path to `.coveragerc` or alternative coverage config file", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wording comes from the other subsystems. It's meant to say that it could for example be pyproject.toml
. See all the options they have at https://coverage.readthedocs.io/en/coverage-5.2/config.html.
def _validate_and_update_config(coverage_config: configparser.ConfigParser) -> None: | ||
if not coverage_config.has_section("run"): | ||
coverage_config.add_section("run") | ||
coverage_config.set("run", "branch", "True") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we still want this turned on by us? I personally don't like when Pants makes decisions like this - who are we to say that you want branch data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am just trying to preserve existing behavior....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged. To clarify, I'm proposing breaking with existing behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this kind of change should be part of its own PR.... especially since this change breaks existing integration tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up on #10289 (comment) [ci skip-rust-tests]
Problem
We currently hard code the coverage configuration file (.coveragerc) so users can't set their own config.
Solution
Allow users to specify a .coveragerc config file and add the inject the parameters we need to that file before passing it to the coverage tool.
Closes #10289.