Hi everyone, I’m using the `2.16rc1` version and I...
# general
Hi everyone, I’m using the
version and I wonder if I have run into a bug. I’m telling pytest to install from a resolve: pants.toml
Copy code
pytest = "resolves/pytest.lock"

pytest= [">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"]

install_from_resolve = "pytest"
and the corresponding lock file contains the versions specified in the requirements: resolves/pytest.lock
Copy code
//   "version": 3,
//   "valid_for_interpreter_constraints": [
//     "CPython!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
//   ],
//   "generated_with_requirements": [
//     "future==0.18.3",
//     "pytest-cov!=2.12.1,<3.1,>=2.12",
//     "pytest-xdist>=1",
//     "pytest==4.6.11"
//   ],
yet, when running
pants test ...
it seems to be ignoring the lock file and using the default one that ships with pants (
pytest-cov>=2.12,!=2.12.1,<3.1, pytest-xdist>=2.5,<3, pytest==7.0.1
Copy code
17:30:15.95 [INFO] Completed: Building 3 requirements for pytest.pex from the resolves/pytest.lock resolve: pytest-cov>=2.12,!=2.12.1,<3.1, pytest-xdist>=2.5,<3, pytest==7.0.1
17:30:15.95 [INFO] Canceled: Building requirements.pex
17:30:15.95 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

ProcessExecutionFailure: Process 'Building 3 requirements for pytest.pex from the resolves/pytest.lock resolve: pytest-cov>=2.12,!=2.12.1,<3.1, pytest-xdist>=2.5,<3, pytest==7.0.1' failed with exit code 1.
I have tried using another name for my resolve and lockfile but it hasn’t worked
Is there anything else under
in your pants.toml?
all I have is this:
Copy code
install_from_resolve = "pytest"
xdist_enabled = false
Oh, right, in that version you have to update
Copy code
# List the (possibly versionless) requirements that should be taken from the lockfile.
The next release candidate, 2.16.0rc2, will not have this flaw
That said - for such a surface level massive major version change, you might expect Pants to fail to run the much older tool.
Sorry, confusing issues like this are why I submitted that PR
Here it's failing to even resolve it, but yeah, if you change a tool version to one Pants hasn't been tested with, it may or may not work, really depends on how consistent the tool's CLI contract is
oh I see, thank you all, I’m going to try that change
It would be ideal if Pants set a hard requirement like
where X was the oldest version to have all the features Pants is using and then apply that:
Copy code
$ pex3 lock create "ansicolors<1.1.8" -olock.json
$ pex --lock lock.json "ansicolors>=1.1.8" -- -c 'import colors; print(colors.__file__)'
Failed to resolve compatible artifacts from lock lock.json for 1 target:
1. /home/jsirois/bin/pex.venv/bin/python:
    Failed to resolve all requirements for cp310-cp310-manylinux_2_35_x86_64 interpreter at /home/jsirois/bin/pex.venv/bin/python from lock.json:

Configured with:
    build: True
    use_wheel: True

Dependency on ansicolors not satisfied, 1 incompatible candidate found:
1.) ansicolors 1.1.7 does not satisfy the following requirements:
    >=1.1.8 (via: ansicolors>=1.1.8)
That would require we really learn the tools we use and we tend to be bad about that currently.
yes, that would be pretty helpful, and something I can use to push my team to upgrade
We do this for the PEX tool "binary" for example. You can customize only within the bounds Pants knows it has the minimum features it uses.
Well, if pytest 4 works for you @lively-gpu-26436 then we'd have out lower bound that low - since it works and you would not have that stick.
Its only if 4 doesn't work that Pants lower bound would be higher. At that point you'd be forced to the lower bound.
Basically this boils down to providing a better error message.
Right now if pytest 4 does not work you'll get a probably hard to understand error.
yes, pytest4 seems to be working fine, it was only with me trying 2.16rc1 that I ran into this issue, but I confirm listing the versionless requirements under [pytest] fixes my issue
Fortunately you won't need to do that in ec2
🎉 1