I'm writing a Pycharm plugin. Basically what I'm trying to do is setting an environment variable on the selected PyTest run configuration. The configuration runs, but I'm not able to set the evars.
Code I came up with:
RunManager runManager = RunManager.getInstance(project);
RunnerAndConfigurationSettingsImpl currRunConfig = (RunnerAndConfigurationSettingsImpl) runManager.getSelectedConfiguration();
RunnerAndConfigurationSettings runConfig = currRunConfig.clone();
PyUniversalPyTestConfiguration prc = (PyUniversalPyTestConfiguration) runConfig.getConfiguration();
Map<String, String> envs = prc.getEnvs();
ProgramRunnerUtil.executeConfiguration(project, runConfig, DefaultRunExecutor.getRunExecutorInstance());
I'm not sure what's the correct way to to set the new Configuration in the RunnerAndConfigurationSettings.
Maybe somebody can help?