thousands-plumber-33255
06/30/2022, 7:10 AMpants.toml
with extra_env_vars
under [test]
. These will be passed to all tests in the monorepo. If I define extra_env_vars
in a specfic python_tests
target, they will be merged.
Can I achieve the following?
Pass a specific set on envs to a specific app in the monorepo, e.g. serviceA
and then for individual tests add some envs to the generally defined ones for the app.happy-kitchen-89482
06/30/2022, 5:10 PM./pants run
? Or when running "the app's tests" (however we define those)?thousands-plumber-33255
07/01/2022, 6:24 AM./pants run
anyway. I mean ./pants test serviceA::
. Let us assume all tests need the envs DB_HOST
and DB_PORT
, but a specific test also needs the env BUCKET_NAME
. Can this be addressed somehow?happy-kitchen-89482
07/01/2022, 12:21 PMextra_env_vars
they will go to all tests, and adding BUCKET_NAME
to extra_env_vars
on a specific test target will add it for the tests on that target.overrides
python_tests(
name="serviceA_tests",
overrides={
"specific_test.py": {
"extra_env_vars": ["BUCKET_NAME"]
}
},
)
python_tests(
name="serviceA_tests",
extra_env_vars=["DB_HOST", "DB_PORT"],
overrides={
"specific_test.py": {
"extra_env_vars": ["DB_HOST", "DB_PORT","BUCKET_NAME"]
}
},
)
thousands-plumber-33255
07/01/2022, 1:07 PMoverrides
does not seem to address the issue. I was trying the new __defaults__
feature, but there is no way to add an env to a specific test while keeping all default values. Or am I missing something there?happy-kitchen-89482
07/01/2022, 1:39 PMoverrides