-
Notifications
You must be signed in to change notification settings - Fork 541
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
feat(toolchain) Add coveragepy configuration attribute #2224
Conversation
ac30050
to
fe7b293
Compare
@rickeylev @aignas PTAL, and please advise how this can be probably tested. |
I know there are analysis tests for the python rules and toolchains, but I am not sure how easy that would be to implement that. |
Ideally we would like to move to a direction that would allow different test runners to be used in the See |
This looks like a really great approach. Does it require changing the py_test rule to accept something similar to the |
Yeah, most likely, but I haven't done a deep dive about it yet. |
Just thinking out loud; some quick thoughts. On the rule side, the config file has to be passed in to something, somewhere. Naively, something in the test rule has a reference to the config as a File somehow (though I suppose not necessary a File, could be something more complex, like the cc_test runner provider with a callback etc) -- directly via an attribute? directly via some provider in deps? indirectly through toolchains? Once it has that file reference, it can then...pass it...somewhere, somehow...so the next step can happen. Next step: the runtime side. So, some way that py_test's stage2 boot can be hooked into? Fundamentally, what this needs to do is change some of the calls stage2 bootstrap makes to the coverage APIs. Another template variable in stage2 bootstrap? A special module that gets import with a hook function? Something I keep coming back to is, if dependencies had some way to more directly hook into the startup/bootstrap process, stuff like this would be easier. |
Let me try to recapitulate @rickeylev Your suggestion will just make it possible to provide a configuration file to coverage-py e.g |
The approach discussed sugested in #2224 (comment) is implemented in |
The PR makes it possible to configure python code coverage through
.coveragerc
file or any other accepted config fileBefore this PR it was not possible to configure code coverage since the configuration was hardcoded within the ruleset. After the PR, users can pass the label to a configuration file
Reference issue
close Allow customized coveragerc for Python coverage #1434