fresh-cat-90827
07/20/2021, 9:27 PMcoverage.py
behaving in a weird way when running tests. It’s being confused about sources for some code:
pants.engine.process.ProcessExecutionFailure: Process 'Generate Pytest xml coverage report.' failed with exit code 1.
stdout:
No source for code: '/private/var/folders/k0/3nssm8v15r5b08k1k1wyhs2r0000gp/T/process-executionzCCweC/(builtin)'.
Aborting report output, consider using -i.
coverage.py
to trip. I wouldn’t post it here given it’s a pure coverage.py
problem, but the path looks dodgy having (builtin)
which looks like some variable expansion / string interpolation issue? Have seen Eric had problems with https://github.com/pantsbuild/pants/pull/11129, not sure if that’s relevant or not. It feels wrong that (builtin)
is in the constructed path.
Ignoring errors when generating coverage HTML reports (https://coverage.readthedocs.io/en/coverage-5.5/config.html#report -- ignore_errors
) works fine and the results look sensible.hundreds-father-404
07/20/2021, 9:30 PM(builtin)
?fresh-cat-90827
07/20/2021, 9:31 PMpants_version = "2.5.1rc3"
and tried on
pants_version = "2.5.1"
hundreds-father-404
07/20/2021, 9:38 PM--no-process-execution-local-cleanup
to inspect what the files look like: https://www.pantsbuild.org/docs/troubleshooting#debug-tip-inspect-the-chroot-with---no-process-execution-local-cleanupfresh-cat-90827
07/20/2021, 9:43 PM├── __run.sh
├── coverage.pex
├── coverage.pex_bin_python_shim.sh
├── coverage.pex_pex_shim.sh
and the source directories that were required to run the tests along with the tests modules(builtin)
has been collected into the .coverage
file and of course when producing report it can’t find ithundreds-father-404
07/20/2021, 9:48 PM./pants test ::
, try ./pants test dir1::
and see if it reproduces. I'm curious if we can narrow down which specific test is resulting in (builtin)
being added
FYI Pants's coverage works by each test generating its own data, then using coverage combine
to get a single .coverage
filefresh-cat-90827
07/20/2021, 9:50 PMAre you able to narrow down by chance which files it’s happening on?oh yes, I know exactly which file is the problem maker 🙂 wanted to check in with you before continuing narrowing down if that problem looked familiar. Will let you know my findings later this week.
hundreds-father-404
07/20/2021, 9:52 PMfresh-cat-90827
07/20/2021, 9:56 PMfishyit’s importing tons of stuff from various peer projects, a bit too nosy 🙂 we will hunt it down
diff --git a/BUILD b/BUILD
index 9c0a8bc..9e6a482 100644
--- a/BUILD
+++ b/BUILD
@@ -20,5 +20,7 @@ python_requirements(
module_mapping={
"ansicolors": ["colors"],
"setuptools": ["pkg_resources"],
+ "PySide2": ["PySide2"],
+
},
)
diff --git a/helloworld/greet/greeting_test.py b/helloworld/greet/greeting_test.py
index 4faa9e8..7e6de79 100644
--- a/helloworld/greet/greeting_test.py
+++ b/helloworld/greet/greeting_test.py
@@ -3,6 +3,7 @@
from helloworld.greet.greeting import Greeter
+from PySide2.QtWidgets import QApplication
def test_greeter() -> None:
greeter = Greeter(languages=["es"], greetings=["good morning"])
diff --git a/pants.toml b/pants.toml
index b5ee007..b5a06bb 100644
--- a/pants.toml
+++ b/pants.toml
@@ -36,3 +36,9 @@ interpreter_search_paths = ["<PATH>", "<PYENV>"]
# See <https://www.pantsbuild.org/docs/protobuf>.
runtime_dependencies = ["//:protobuf"]
mypy_plugin = true
+
+[test]
+use_coverage = true
+
+[coverage-py]
+report = ["html"]
diff --git a/requirements.txt b/requirements.txt
index ffab1be..f11aee9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,3 +5,4 @@ ansicolors>=1.0.2
setuptools<54.0,>=50.3.0
translate>=3.2.1
protobuf>=3.11.3
+PySide2
hundreds-father-404
07/20/2021, 10:40 PMfresh-cat-90827
07/20/2021, 10:43 PMbuiltin
thing will pop-up. Thanks for helping out with this quest.coverage.py
runs the code with PySide2 just fine and it looks like Pants may be doing something that causes coverage to be confused with the paths. 😞 I’ve authored a minimal repro in a public GitHub repo — https://github.com/alexey-tereshenkov-oxb/monorepo-coverage-pants. It showcases how coverage.py
works and how Pants fails.
I’ll make coverage.py
ignore the errors to be able to go on with my life, but thought it may be worth sharing with you the repo in case you’d ever want to step through what Pants is doing on the minimal monorepo. @hundreds-father-404hundreds-father-404
07/21/2021, 2:40 PMfresh-cat-90827
07/21/2021, 2:55 PMenough-analyst-54434
07/31/2021, 8:44 PM