I'm starting to introduce multiple lockfiles. Acco...
# general
a
I'm starting to introduce multiple lockfiles. Accordingly, I've now got a
pytest
lockfile with pytest plus the various plugins I need. Some of my tests import pytest, which then fails cos pytest is in the pytest lockfile, and not the lock for the code under test. Do I just add my pytest requirements to every lockfile? Sorry if that's hard to parse 😄
h
pytest
needs to be in the lockfile for code that imports it, just like any other 3rd party distribution. So the initial thing to do is to have
pytest
in the tool lockfile and the code lockfile(s) and keep them in sync. But if you want to get more sophisticated, and avoid that duplication, you can tell Pants to resolve the
pytest
tool from a code lockfile: https://www.pantsbuild.org/2.26/docs/python/overview/lockfiles#sharing-lockfiles-between-tools-and-code
a
Yeah, thats the pattern I had before, but with multiple lockfiles that breaks down. All good, thanks!