thousands-plumber-33255
06/30/2022, 7:10 AMthousands-plumber-33255
06/30/2022, 9:18 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)?happy-kitchen-89482
06/30/2022, 5:10 PMthousands-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.happy-kitchen-89482
07/01/2022, 12:21 PMoverrideshappy-kitchen-89482
07/01/2022, 12:22 PMhappy-kitchen-89482
07/01/2022, 12:23 PMpython_tests(
    name="serviceA_tests",
    overrides={
        "specific_test.py": {
            "extra_env_vars": ["BUCKET_NAME"]
        }
    },
)happy-kitchen-89482
07/01/2022, 12:24 PMhappy-kitchen-89482
07/01/2022, 12:25 PMpython_tests(
    name="serviceA_tests",
    extra_env_vars=["DB_HOST", "DB_PORT"],
    overrides={
        "specific_test.py": {
            "extra_env_vars": ["DB_HOST", "DB_PORT","BUCKET_NAME"]
        }
    },
)happy-kitchen-89482
07/01/2022, 12:27 PMhappy-kitchen-89482
07/01/2022, 12:27 PMthousands-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 PMoverrideshappy-kitchen-89482
07/01/2022, 1:39 PMhappy-kitchen-89482
07/01/2022, 1:40 PM