How to set environment variables generated external tool before running test runner
Answered
Hi,
I have a following situation. We are using special tool to manage environment variables before we run our unit and integration tests. I know I can configure those in the tool launch configuration. Unfortunately our environment is very dynamic and I have to re-enter them every time something changes. Is it possible to run the external tool and set environment variables generated by the tool before running the test runner?
Normally on the command like we do something like this eval $( get-my-config ) ; run_tests.sh
Please sign in to leave a comment.
Hello. This is not possible now, be there is a similar feature request: https://youtrack.jetbrains.com/issue/PY-5543
You can join discussion and suggest to provide ability to run any external tool on the same shell to set env. variables.
I'ts been a couple of years since this post was first made, but i would like to add my voice to this.
We have an `environment launcher` that runs before the execution of python. I just want to be able to specify that before running tests, run that script in the same shell.
the discussion that was linked seems to be a different problem, and even if it could be patched with that, it is still not implemented / accepted
Yeah I have the exact same requirement as @... - i have tried to have a script run before executing my main run configuration but it seems the script is executed in another terminal environment.
I will add a me-too - and a bit agog that after years and years (I found Stackoverflow posts requesting similar going back to 2013) that this still isn't added/supported.
I had the same need for my java applications.
Since I couldn't use a script that is launched before my run/debug in the same terminal so I can reuse the env variables, and that the envfile plugin cannot use a script that generates the file,
I ended up using a maven plugin to generate the env variables, and run my app as a maven goal on intellij.
Here is the doc: https://homeofthewizard.github.io/vault-maven-plugin/
It is basically creating env variables or system properties in the JVM of maven, and if you execute your app in the same JVM, your app will be able to access them.
It is IDE agnostic, pure java solution that works on every environment (docker, local windows/linux/mac).