My `python_library` depends on a `resource` that I...
# general
s
My
python_library
depends on a
resource
that I'm hoping the
pex_binary
target will package correctly as a package resource during packaging. If my library reads this resource via
pkg_resources
tooling will my
python_test
target be able to call the library code that reads the package, or is the code under test not "packaged" at point of testing? This currently isn't working but I'm not sure if it's configuration a error or I'm expecting this to work when it's not going to
c
I don’t know the answer to that, but my expectation would be the same, that it ought to work, as long as your python source has a dependency on the resource, it should be available during test as well.
I would run with
./pants --no-process-execution-local-cleanup test …
in order to be able to inspect the created sandbox for the test run to see what is in there…
s
Thanks @curved-television-6568 I'm just getting to grips with debugging the sandboxes. I see that my sandbox contains my
projects
directory (where my service lives) and my
library
directory where my resource live (along side library code) Does this imply that it's just copying the required directories into the sandbox and testing them from there? When I build my pex binary those library files get put in the root of the zip.
c
I believe so (copying the required files, I would say, as it would not copy over sibling files that is not part of the transitive depedency graph for the test). Not sure about where the files end up in the pex zip, though..
s
Ok sorted this out, thanks for the help. I needed to put the resources in a subfolder.
👍 1