Uh oh!
There was an error while loading. Please reload this page.
feat(toolchain) Add coveragepy configuration attribute - #2224
Conversation
ac30050 to
fe7b293Compareewianda
commented
Sep 16, 2024
@rickeylev@aignas PTAL, and please advise how this can be probably tested. |
aignas
commented
Sep 18, 2024
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. |
aignas
commented
Sep 18, 2024
Ideally we would like to move to a direction that would allow different test runners to be used in the See |
ewianda
commented
Sep 18, 2024
This looks like a really great approach. Does it require changing the py_test rule to accept something similar to the |
aignas
commented
Sep 19, 2024
Yeah, most likely, but I haven't done a deep dive about it yet. |
rickeylev
commented
Sep 19, 2024
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 |
ewianda
commented
Oct 31, 2024
The approach discussed sugested in #2224 (comment) is implemented in |
The PR makes it possible to configure python code coverage through
.coveragercfile 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
closeAllow customized coveragerc for Python coverage #1434