In CI I am running my django tests with those sett...
# general
t
In CI I am running my django tests with those settings:
Copy code
__defaults__(
    {
        python_tests: dict(
            dependencies=[
                "django/django_core/settings.py",
                "django:pytest-django",
            ],
            extra_env_vars=env_vars_test_django(),
        )
    }
)
My goal here is to set a list of environments as defined in a macro. Now, I would like to run
pants run django/manage.py -- makemigrations --check
, but I am not able to set this list of environments as the field is unregonized for a
pex_binary
target. 1. How can I adress this? Is env in 2.16 the equivalent? 2. Can I pass the macro function in in a CLI argument as well or only in a BUILD file?
pants run --env=env_vars_test_django() django/manage.py -- makemigrations --check
h
Re 2. no, that won't work, macros are strictly a BUILD file thing.
Re 1. unlike other goals, which are very isolated by design,
run
will take env vars from the ambient environment, so you can just set them there
t
Re 2. so in that case I would need an additional target for which I specify this particular need I guess Re 1. I would need to an additional script to call that macro function and set it in the environment. Is this new env feature equivalent or is there any other way to pass it to the pex target?
@happy-kitchen-89482?
h
You can set env vars however makes sense to you, but I don't know if calling a macro is what I would do. Maybe having .env file that the macro reads, or something like that?