re pytest-plugins - im hitting another ~related is...
# general
a
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
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
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
Can you not generate your lockfile to use the version you're expecting to use?
a
not sure why i couldnt get generate-lockfile to use the local path
b
Can you be more specific? What have are you trying + what you're seeing
a
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
Ah yeah I think thats supported in PEX lockfiles
a
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
FWIW why not have a "root" conftest.py which loads that plugin? Then you don't need it in
extra_requires
?
a
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
Yeah I can't say I'm versed enough to figure this out more 😕
a
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