Uh oh!
There was an error while loading. Please reload this page.
fix(coverage): prevent issues when packages execute files in tmp dir. - #2599
fix(coverage): prevent issues when packages execute files in tmp dir.#2599BurnzZ wants to merge 3 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
since subprocess.call won't exapnd environment variables. Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
aignas
commented
Feb 3, 2025
My thinking is that the
We have a proposal here for this: #2246. Some thoughts about this change:
I think there are many other things I am forgetting, but wanted to mention greater design concerns here. I am not too much against this as a temporary fix for the actual problem at hand, but I would like to have a better story for testing and configuration in |
groodt
commented
Feb 3, 2025
Yes, indeed. There are also solutions to this which might be solved in userspace instead. Similar to https://pypi.org/project/pytest-bazel/ I do like a userspace solution, but the "batteries included" coverage supporting configuration files makes sense while we are bundling |
BurnzZ
commented
Mar 5, 2025
Noting that this proposed PR might not be needed since the PR in #2607 that adds |
…ests (#2607) This ensures that un-executed files _(i.e. files that aren't tested)_ are included in the coverage report. The current behavior is that coverage.py excludes them by default. This PR configures source files via the auto-generated `.coveragerc` file. See https://coverage.readthedocs.io/en/7.6.10/source.html#execution: > If the source option is specified, only code in those locations will be measured. Specifying the source option also enables coverage.py to report on un-executed files, since it can search the source tree for files that haven’t been measured at all. Closes#2599Closes#2597Fixes#2575 --------- Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Pytorch generates some python files in the tmp dir and executes them; coverage then fails due to not being able to find the source files. We pass a flag to omit the tmp dir from coverage reporting. Commit: 6ff10ae Branch: https://github.com/bazeltools/rules_python/tree/patch-tmp-coverage-1.6.1 This approach is from the discussion in bazel-contrib#2599 (comment)
Background
(A good addition to #2597)
This is a proposal to have a workaround for #2575 where an inherent issue from coverage.py when creating the lcov output file.
Proposed Changes
Add an
--omit='...'flag pointing to tempdir.Reproducible steps
We can see how this proposal addresses the issue described from https://github.com/BurnzZ/rules_python.
MODULE.bazel: