Another win for us: migrating python tests and ena...
# general
b
Another win for us: migrating python tests and enabled
[python-infer].assets
. • Run test • test fails "No such resource: XYZ" • Add relevant
BUILD.pants
• test succeeds No need to declare the
overrides: {"filename.py": dependencies: ["resourcepath1", "resourcepath2"]}
😈
💯 3
h
Where can I read up on the path inference? We often do things like
pathlib.Path(__file__)
and potentially some form of
.parent
or
.parents
and get the necessary resource/file.
b
As you can hopefully imagine it's quite simple today. Basically it takes strings with some number of slashes in it (configurable) and tries to match them to
resources
relative tot he files' parent or
files
relative to build root.
h
Cool. I'll try it out!
b
So
pkgutil.get_data("data/foo.txt")
would be inferred if there's a resource at
__file__ / ".." / "data" / "foo.txt"
h
I'm excited also that we can continue to improve this inference over time. Josh laid the foundation
1