Hi, not sure if this the right place, but I’m stru...
# general
e
Hi, not sure if this the right place, but I’m struggling with setting up test dependencies. I’m following the same structure and configuration as noted in the docs. My pytest section in
pants.toml
looks like this:
Copy code
[pytest]
install_from_resolve = "pytest"
requirements =["//3rdparty/python:pytest"]
execution_slot_var = "PANTS_EXECUTION_SLOT"
config = "tools/pytest.ini"
Other files like BUILD in the
3rdparty/python
with the
pytest
python_requirements
exists and dedicated requirements file. This the error I get:
Copy code
09:51:58.73 [INFO] Canceled: Building 6 requirements for requirements.pex from the 3rdparty/python/lockfiles/default.lock resolve: UnleashClient>=5.8.0, django>=4, pydantic-settings>=2.0.3, pytest==7.0.1, returns>=0.19.0, structl... (10 characters truncated)
09:52:00.18 [INFO] Completed: Building 1 requirement for pytest.pex from the 3rdparty/python/lockfiles/pytest.lock resolve: //3rdparty/python:pytest
09:52:00.19 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

ProcessExecutionFailure: Process 'Building 1 requirement for pytest.pex from the 3rdparty/python/lockfiles/pytest.lock resolve: //3rdparty/python:pytest' failed with exit code 1.
stdout:

stderr:
<string> line 1:
//3rdparty/python:pytest
Problem parsing '//3rdparty/python:pytest' as a requirement: Parse error at "'//3rdpar'": Expected W:(abcd...)
I tried
Copy code
requirements =["3rdparty/python:pytest"]
but same parsing error, only on
/python
. Any help is welcome. Thanks in advance!
1
n
Try
requirements = ["pytest"]
instead.
e
That helped, thanks!
n
The docs do say that the values can be pip-style requirements or addresses of python_requirement targets though, so not sure why addresses didn’t work for you.
e
Yeah, it confused me as well (I’m on pants version `2.16.0rc0`')
c
I’d be curious if
pants_version = "2.16.0"
had the same issue
h
That may have been fixed in 2.16.0, can you try?
e
Yes, it seems to be working with this version 🎉
h
Great!