hallowed-address-41201
07/11/2023, 7:36 AMpyproject.toml called project-dbdumper which is a command line executable called dbdumper . I have a session scoped fixture that will restore the dump before tests start using subprocess.call(dbdumper --database X --dump Y)
For all my test BUILD files, I have added the package as a dependency:
dependencies=[
"//:root#project-dbdumper",
....
]
I have two questions:
⢠If I just execute pants test :: it will not find the dbdumper executable, and fail. How can I reference the dependency within the sandbox?
⢠If I source the exported pants .venv before executing pants test :: my PATH contains PATH=.venv/bin and the tests will find the exectuable dbdumper . But I find this behavior strange. How can it be hermetic if it honors the current PATH set for the user when executing pants test :: am I missing something?hallowed-address-41201
07/11/2023, 8:51 AMpyest_runner.pex_pex_shim.sh in the sandbox sets a virtualenv variable inside the script venv_dir="$(adjust_relative_paths .cache/pex_root/venvs/.....)" which is where the dbdumper bin files is located, but I cannot see that it exports this path for usage.hallowed-address-41201
07/11/2023, 11:37 AMproject-dbdumper to the repository, created a pex_binary target, and added it as a runtime_package_dependencies for my python_tests and it works perfectly! Woo!
I can then reference the local pex in my fixture like this: ./dbdumper.pex ... .curved-television-6568
07/11/2023, 11:38 AMproject-dbdumper a executable (packagable) target? if so take a look at https://www.pantsbuild.org/docs/reference-python_tests#coderuntime_package_dependenciescode
Ah, yes, you found out, great! š