use of com.jetbrains.python.testing.AbstractPythonLegacyTestRunConfiguration in project intellij-community by JetBrains.
the class PyUnitTestTask method runConfiguration.
protected void runConfiguration(ConfigurationFactory factory, String sdkHome, final Project project) throws Exception {
final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration("test", factory);
AbstractPythonLegacyTestRunConfiguration config = (AbstractPythonLegacyTestRunConfiguration) settings.getConfiguration();
config.setSdkHome(sdkHome);
config.setScriptName(getScriptName());
config.setWorkingDirectory(myFixture.getTempDirPath());
PythonSdkFlavor sdk = PythonSdkFlavor.getFlavor(sdkHome);
if (sdk instanceof JythonSdkFlavor) {
config.setInterpreterOptions(JythonSdkFlavor.getPythonPathCmdLineArgument(Lists.<String>newArrayList(myFixture.getTempDirPath())));
} else {
PythonEnvUtil.addToPythonPath(config.getEnvs(), myFixture.getTempDirPath());
}
configure(config);
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
RunManagerEx.getInstanceEx(project).addConfiguration(settings, false);
RunManagerEx.getInstanceEx(project).setSelectedConfiguration(settings);
Assert.assertSame(settings, RunManagerEx.getInstanceEx(project).getSelectedConfiguration());
}
}.execute();
runConfiguration(settings, config);
}
Aggregations