<https://www.pantsbuild.org/stable/docs/python/ove...
# general
w
https://www.pantsbuild.org/stable/docs/python/overview/lockfiles#lockfiles-for-tools is there some way to specify the resolve for pytest in a BUILD? we have a monorepo with different components each with their own resolves. one component needs features from pytest 8, but pants only supplies 7.0.1 this component's resolve specifies pytest 8, we use nix so the cli version of pytest matches, but when
pants test
is run (in ci) it uses v7
2
h
Hmm, I guess the resolve for a
python_test
target is the one the test’s dependencies are resolved from, not the one
pytest
is resolved from.
So you can specify different lockfiles to resolve pytest from via the mechanism you linked to, but you have to pick one per Pants run, so I guess you’d need to run Pants twice (with different config/flags each time), once for the pytest 8 components and once for the pytest 7 components
Not ideal
b
Is there any reason you need to have Pytest 7 be present? If you are OK with using Pytest 8 for everything then you can use a custom resolve for pytest as in the link you shared above
h
Oh, good point, if you don’t need pytest 7 specifically, and you’re only using it because it’s the built in default in Pants, then you can simply upgrade to 8 across the board, and problem solved.
w
that's what i've done in the end, luckily it was a smooth transition to pytest 8 for all the components
🎉 2