<#19395 Unable to use combined lockfile for pytest...
# github-notifications
c
#19395 Unable to use combined lockfile for pytest Issue created by wfscheper Describe the bug Using the instructions at https://www.pantsbuild.org/docs/python-lockfiles#sharing-lockfiles-between-tools-and-code fails due to incompatible interpreter constraints between my code base and the pytest subsystem. I don't seem to be able to override the pytest default of
CPython<3.10,>=3.7
.
Copy code
$ pants test ::
<truncated>
16:35:02.78 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

InvalidLockfileError: You are consuming `pdbpp`, `pygments`, and 3 other requirements from the `python-default` lockfile at 3rdparty/python/default.lock with incompatible inputs.



- The inputs use interpreter constraints (`CPython<3.10,>=3.7`) that are not a subset of those used to generate the lockfile (`CPython>=3.8`).

- The input interpreter constraints are specified by your code, using the `[python].interpreter_constraints` option and the `interpreter_constraints` target field.

- To create a lockfile with new interpreter constraints, update the option `[python].resolves_to_interpreter_constraints`, and then generate the lockfile (see below).

See <https://www.pantsbuild.org/v2.16/docs/python-interpreter-compatibility> for details.

To regenerate your lockfile, run `pants generate-lockfiles --resolve=python-default`.

See <https://www.pantsbuild.org/v2.16/docs/python-third-party-dependencies> for details.

16:35:02.87 [INFO] Canceled: Building 3 requirements for requirements.pex from the 3rdparty/python/default.lock resolve: decorator<6,>=5.1.1, python-dateutil<3,>=2.8.1, requests<3.0.0,>=2.26.0
Subset of my pants.toml:
Copy code
[python]
enable_resolves = true
default_resolve = "python-default"
interpreter_constraints = [">=3.8"]

[python.resolves]
pants-plugins = "pants-plugins/lock.txt"
python-default = "3rdparty/python/default.lock"

[python.resolves_to_interpreter_constraints]
pants-plugins = ["CPython>=3.7,<3.10"]

[pytest]
install_from_resolve = "python-default"
requirements = [
  "//3rdparty/python#pytest",
  "//3rdparty/python#pygments",
  "//3rdparty/python#pytest-icdiff",
  "//3rdparty/python#pytest-mock",
  "//3rdparty/python#pdbpp",
]
execution_slot_var = "PANTS_EXECUTION_SLOT"
Pants version 2.16.0 OS Linux (can try and reproduce on macOS if needed). Additional Info If I generate a separate pytest lockfile, then the pytest.lock uses my default IC and
pants test
doesn't complain about conflicting constraints. That makes me think I did something wrong, but it's not clear to me what that is. pantsbuild/pants