https://pantsbuild.org/ logo
c

curved-microphone-39455

12/22/2022, 6:27 PM
Hello There! (insert Obi-Wan gif here) When activating the
coverage-py
in my in my
.toml
for me pipeline, it always fail because of this error
Copy code
17:20:21.82 [ERROR] 1 Exception encountered:
  ProcessExecutionFailure: Process 'Generate Pytest html coverage report.' failed with exit code 1.
stdout:
Couldn't parse '/tmp/pants-sandbox-wxTI0G/src/libraries/lib/lib/v2/models/_potential_access_points/_deployment_provider_type.py' as Python source: 'invalid syntax' at line 25
Copy code
[test]
report = true
use_coverage = true

[coverage-py]
report = ["html"]
global_report = true
We are using Python 3.10 at this is a Switch statement at this line, do you have an idea to my coverage work with this ?
w

wide-midnight-78598

12/22/2022, 6:29 PM

https://media.giphy.com/media/R5YYY4JI51Gq4/giphy.gif

?
Does your TOML have any interpreter_constraints specified?
If your Pants version doesn't use coverage >= 6 this will never work. You'll need to override https://www.pantsbuild.org/docs/reference-coverage-py#version and specify a lock file path https://www.pantsbuild.org/docs/reference-coverage-py#lockfile and then run
./pants generate-lockfiles --resolve=coverage-py
... and then proceed with maybe success.
c

curved-microphone-39455

12/22/2022, 6:44 PM
Thanks I will try this
e

enough-analyst-54434

12/22/2022, 6:53 PM
Let us know if it works, and if so consider contributing back a bump for future Pants releases to have this support by default: https://github.com/pantsbuild/pants/blob/672ca1d662c76f2567e432347deee8949c14d35d/src/python/pants/backend/python/goals/coverage_py.py#L114-L118
Oops! Someone did bump it.
😄 1
c

curved-microphone-39455

12/22/2022, 6:56 PM
I am @ 2.14.0, I will try with the new pants version
e

enough-analyst-54434

12/22/2022, 7:02 PM
Sounds good. We're just up to 2.15.0rc0: https://pypi.org/project/pantsbuild.pants/2.15.0rc0/
c

curved-microphone-39455

12/22/2022, 7:03 PM
How fast are usually a cycle from
beta
to
stable
? just curiosity here 🙂
e

enough-analyst-54434

12/22/2022, 7:12 PM
Don't trust any of us, we're not great about regularity. Trust the data: https://pypi.org/project/pantsbuild.pants/#history
👀 1
But if you're worried about 2.15, you can just use those 2 edits and lockfile-regen I described to get this working on stable Pants.
c

curved-microphone-39455

12/22/2022, 7:13 PM
Yeah I will try this first, Thanks for everything!
3 Views