Q. I'd like to refer a file in the build root in t...
# general
r
Q. I'd like to refer a file in the build root in the test cases executed via
python_tests()
target. It seems that
%(buildroot)s
expansion is not working in BUILD files. How could I achieve a similar thing? e.g.,
Copy code
python_tests(
    name="tests",
    extra_env_vars=[
        "BACKEND_CONFIG_FILE=%(buildroot)s/manager.toml",
    ],
)
Ah.. maybe another way to do this is to make
manager.toml
as an explicit resource file as a dependency of
python_tests()
.
hmm.. still not working..
and also I encountered another problem with testing codes that tries to read package metadata (entrypoints) ...
BUILD files are not copied into the src directory inside the pex environment generated for running pytest...
made an issue for the entrypoint: https://github.com/pantsbuild/pants/issues/15481
Tried
runtime_package_dependencies
but it seems not working as well..
b
You'll want to declare the toml file as a
file
, and then declare the dependency from your test to the
file
👆 1