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 intobazel-contrib:mainfrom
Conversation
since subprocess.call won't exapnd environment variables. Co-authored-by: Richard Levasseur <[email protected]>
|
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 |
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 |
|
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 #2599 Closes #2597 Fixes #2575 --------- Co-authored-by: Ignas Anikevicius <[email protected]>
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: