https://pantsbuild.org/ logo
#general
Title
# general
a

adorable-engine-71736

05/25/2022, 12:10 PM
re pytest-plugins - im hitting another ~related issue with the lockfiles - basically if i try to test the pytest-plugin package it always tests against the one that it has in the lockfile, not the one in my repo i guess the workaround is to use a separate lockfile when testing the plugin package, but not sure how to achieve that with pytest. Perhaps this can also be resolved with new PEX way - wondering if i can test this already
b

bitter-ability-32190

05/25/2022, 6:47 PM
So this is a spot where Pants can improve (I couldn't find the issue). Basically if pytest is in your repo's lockfile PEX has to choose between it and the version in the pytest lockfile. I dont remember who wins in this case. Ideally they can agree on one version
a

adorable-engine-71736

05/25/2022, 6:49 PM
im using 2.9 - it seems the lockfile always wins - the only workaround i could get to work is hacking the lockfile directly and setting it to whl file + hash
b

bitter-ability-32190

05/25/2022, 6:50 PM
Can you not generate your lockfile to use the version you're expecting to use?
a

adorable-engine-71736

05/25/2022, 6:50 PM
not sure why i couldnt get generate-lockfile to use the local path
b

bitter-ability-32190

05/25/2022, 6:51 PM
Can you be more specific? What have are you trying + what you're seeing
a

adorable-engine-71736

05/25/2022, 6:51 PM
i thought i had it working previously (one the package was manually published) so it may be a caching issue again
sure
setting something like....
Copy code
pytest-myplugin @ file:///path/to/my/repo
in pytest::extra_requirements
b

bitter-ability-32190

05/25/2022, 6:53 PM
Ah yeah I think thats supported in PEX lockfiles
a

adorable-engine-71736

05/25/2022, 6:53 PM
that doesnt seem to work at all (altho i thought it sort of worked previously)
my hack workaround is this in the lockfile...
Copy code
pytest-abstracts @ file:///src/workspace/pytooling/pytest-abstracts/dist/pytest_abstracts-0.0.4-py3-none-any.whl \
    --hash=sha256:790930c31f182688bb1c2a10b8e3051dda61e7f97bee28af0698c25a39de4bc2
it was the only way i could find to get it testing/using the unpublished/local verion
b

bitter-ability-32190

05/25/2022, 6:56 PM
FWIW why not have a "root" conftest.py which loads that plugin? Then you don't need it in
extra_requires
?
a

adorable-engine-71736

05/25/2022, 6:57 PM
i can look further - but mostly i have the packages testing independently - perhaps they could still share conftest.py
my preference would be for each package (root) to be able to specify its own pytest/mypy/etc deps
which i think i used to be able to do before the lockfiles were added (iirc)
b

bitter-ability-32190

05/25/2022, 7:27 PM
Yeah I can't say I'm versed enough to figure this out more 😕
a

adorable-engine-71736

05/26/2022, 9:00 AM
thanks for help anyway - i have a hacky workaround for dev now - and im not testing much in the plugin so its not such an issue atm i will try removing the extra_requirements and see if i can find a way to feed them into the test env (conftest.py i guess) separately which would resolve both issues if it works
4 Views