cool-easter-32542
05/09/2024, 11:16 AMextra_env_vars, either on the test or in pants.toml. If we have a monorepo with multiple projects, to have the env vars applied to all tests for a project, we set it in pants.toml. But then the extra_env_vars field becomes a giant set of all env vars for all projects.
Describe the solution you'd like
It would be good if there were a way to set the env vars to pass to tests from the host at a per project level. e.g. if the project structure is like this:
root
|--projectA
|------src
|------tests
|------Build
|--projectB
|------src
|------tests
|------Build
|--pants.toml
If we could set something in projectA/Build or similar that would ensure that a set of env vars are passed to the environment when projectA tests are run, and a different set of env vars can be set in projectB/Build that would apply when projectB tests are run.
Describe alternatives you've considered
Josh suggested on the slack channel that something like this might be doable if we set:
python_tests.__defaults__.extra_env_vars
in the relevant Build file. I'll test whether this works, but it would be preferable if there was a more formal way to specify something like this.
pantsbuild/pants