I’m trying to run `./aiq pants --pants-runtime-pyt...
# general
c
I’m trying to run
./aiq pants --pants-runtime-python-version=3.6 test.pytest --test-pytest-coverage=src/python/aiq/datadog_metrics test/python/aiq/datadog_metrics::
on Jenkins and I’m seeing this error
Copy code
ERROR: usage: 0d9ce81594a0551c52a94d1563370c73059e6817 [options] [file_or_dir] [file_or_dir] [...]
Copy code
0d9ce81594a0551c52a94d1563370c73059e6817: error: unrecognized arguments: --cov-report= --cov-config /home/jenkins/workspace/tests/run_python3_tests/jd/test-datadog-metrics-typo/.pants.d/test/pytest/test.python.aiq.datadog_metrics.test_datadog_metrics/tmpkq_tuem0 --cov /home/jenkins/workspace/tests/run_python3_tests/jd/test-datadog-metrics-typo/.pants.d/pyprep/sources/e79db9b71ba23be870dc484b8dcfa08e6db39185/aiq/datadog_metrics/ /home/jenkins/workspace/tests/run_python3_tests/jd/test-datadog-metrics-typo/.pants.d/pyprep/sources/e79db9b71ba23be870dc484b8dcfa08e6db39185/aiq/datadog_metrics/test_datadog_metrics.py
I’m using pants 1.16 and coverage 5.3. I’m not sure what I need to change for this to work. Any ideas? Thanks!
h
Hi John, can you please check if your pants.ini or pants.ci.ini are setting anything in the [pytest] section? I’m wondering if y’all accidentally uninstalled the pytest-cov plugin Also, was this working before? Does it work for any coworkers?
c
This was not working before, this is something new I’m trying. I do not have
<http://pants.ci|pants.ci>.ini
, but in
pants.ini
I see
Copy code
[pytest]
requirements: pytest==4.6.9
unittest2_requirements: zipp==1.0.0
cov_requirements: configparser==4.0.2

[test.pytest]
extra_pythonpath: ["%(pants_workdir)s/ivy/jars/graphframes/graphframes/jars/graphframes-0.5.0-spark2.1-s_2.10.jar"]
;options: +["--log-level=INFO", "--log-cli-level=INFO"]
h
Ah okay, so it looks like you’re overriding cov_requirements, which is breaking this. How feasible would it be to upgrade to a newer Pants version? We made an improvement so that you can add any arbitrary requirement, whereas right now, you have to override one of the few spots we had. Iirc, it was added in 1.17
c
It’s not feasible for me right now, but it is something we plan to do in the future
h
Okay, the only “slot” for
[pytest]
not yet taken that you could use is
timeout_requirements
. Or, stop pinning
configparser
or
zipp
. Do you know if you’re using timeouts in your repo? If so, you’d break that if you claim it. (Sorry, we know this is a frustrating problem, hence fixing in 1.23.0)
c
Yeah, I’m expecting a little frustration, so it’s ok 😉 It looks like we are not using timeout_requirements anywhere and I don’t think we’re using the timeouts module
so you’re suggesting moving
configparser==4.0.2
to timeout_requirements?
h
Exactly, and then
pytest-cov
will be installed through the default
cov_requirements
option. You may want to change the version used; you can use
./pants help-advanced pytest
to see the default
c
great, I’ll try that. Thank you!
h
I will warn you that the original coverage implementation was not…great. Unless your project was set up a particular way, it was clunky to get coverage data generated for the proper files. We redesigned it in 1.30 to be much simpler. https://www.pantsbuild.org/docs/how-to-upgrade-pants-2-0#coveragepy-support-was-redesigned-v1-engine-vs-v2-engine describes the differences Generally, Pants’s Python support was redesigned from the ground up to be much improved with the new “v2” engine, including much better caching; more concurrency; a less chatty UI; and new features like Pylint, Flake8, and Black support, lock file support, and dependency inference, where you can leave off the
dependencies
field in BUILD files Ik you said upgrading isn’t possible right now, but let us know if there’s anything we can do to help