Hi, I am trying to use an approach like <https://w...
# general
l
Hi, I am trying to use an approach like https://www.pantsbuild.org/docs/python-test-goal#testing-your-packaging-pipeline to do a kind of integration test of a packaging pipeline for a python distribution (I am following along Publishing Python Packages but trying to do it with pants rather than build/tox). In the examples in the doc we run tests against a pex built elsewhere in the repo via
runtime_package_dependencies
. I am trying to test instead against a pip/setuptools package (with a native extension) built somewhere else in the repo. To simulate a user pip installing the package into their application and running the tests against that. How can I have pants supply the dependency from the built package rather than from the source that builds the package? Adding the
python_distribution
target to the
runtime_package_dependencies
of the test just copies the dist/wheel into the sandbox but does not import them from what I can tell by poking around. If you can help me with this I promise I'll make an addition to that section of the docs 🙂.
ah, I should try this approach: https://github.com/pantsbuild/pants/pull/12573 . Let me see if that works ...
ok, with that it worked as long as the package does not have other deps. Will figure out how to address that and then will add something to the docs.
b
I was thinking, could you build a PEX from your distribution? That should include it's dependencies, right?
l
Interesting, if I had a pex and depended on it as a runtime package dependency I would be able to test the contained code by importing it in pytests and not only by calling the pex's entrypoint in a subprocess?
b
I think so, I'm not sure the right incantation, but I'm like 85% that mechanism is built in
g
@late-advantage-75311 Do let me know if that works for you. I am interested to use that as well in my project.
👍 1
l
Sigh, I could not get it to work, and spent a fair amount of time debugging. I hope I am missing something small, if not, that there is a path to make something like this work. Created an issue detailing it with a repo to reproduce. Maybe this is a known limitation. https://github.com/pantsbuild/pants/issues/19625