diff --git a/platform/core-impl/src/com/intellij/execution/process/CommandLineArgumentsProvider.java b/platform/core-impl/src/com/intellij/execution/process/CommandLineArgumentsProvider.java index 207ba23c76ae..c7ca1e1bcf77 100644 --- a/platform/core-impl/src/com/intellij/execution/process/CommandLineArgumentsProvider.java +++ b/platform/core-impl/src/com/intellij/execution/process/CommandLineArgumentsProvider.java @@ -25,7 +25,10 @@ import java.util.Map; /** * @author Roman.Chernyatchik, oleg + * @deprecated Use GeneralCommandLine instead + * @deprecated Usages only in Ruby. Move to Ruby module? */ +@Deprecated public class CommandLineArgumentsProvider { /** * @return Commands to execute (one command corresponds to one add argument) diff --git a/python/ide/src/com/jetbrains/python/PyIdeCommonOptionsForm.java b/python/ide/src/com/jetbrains/python/PyIdeCommonOptionsForm.java index 254e41a9acc7..9bd0fcbe8302 100644 --- a/python/ide/src/com/jetbrains/python/PyIdeCommonOptionsForm.java +++ b/python/ide/src/com/jetbrains/python/PyIdeCommonOptionsForm.java @@ -364,4 +364,10 @@ public class PyIdeCommonOptionsForm implements AbstractPyCommonOptionsForm { public void sdkHomeSelected(Sdk sdk, String newSdkHome) { } } + + @Override + public String getModuleName() { + Module module = getModule(); + return module != null? module.getName() : null; + } } diff --git a/python/openapi/src/com/jetbrains/python/run/AbstractPythonRunConfigurationParams.java b/python/openapi/src/com/jetbrains/python/run/AbstractPythonRunConfigurationParams.java index 113da30692a5..812cb72ebe90 100644 --- a/python/openapi/src/com/jetbrains/python/run/AbstractPythonRunConfigurationParams.java +++ b/python/openapi/src/com/jetbrains/python/run/AbstractPythonRunConfigurationParams.java @@ -16,53 +16,12 @@ package com.jetbrains.python.run; import com.intellij.openapi.module.Module; -import com.intellij.util.PathMappingSettings; import org.jetbrains.annotations.Nullable; -import java.util.Map; - /** * @author Leonid Shalupov */ -public interface AbstractPythonRunConfigurationParams { - String getInterpreterOptions(); - - void setInterpreterOptions(String interpreterOptions); - - String getWorkingDirectory(); - - void setWorkingDirectory(String workingDirectory); - - @Nullable - String getSdkHome(); - - void setSdkHome(String sdkHome); - +public interface AbstractPythonRunConfigurationParams extends PythonRunParams { @Nullable Module getModule(); - - void setModule(Module module); - - boolean isUseModuleSdk(); - - void setUseModuleSdk(boolean useModuleSdk); - - boolean isPassParentEnvs(); - - void setPassParentEnvs(boolean passParentEnvs); - - Map getEnvs(); - - void setEnvs(final Map envs); - - @Nullable - PathMappingSettings getMappingSettings(); - - void setMappingSettings(@Nullable PathMappingSettings mappingSettings); - - boolean shouldAddContentRoots(); - boolean shouldAddSourceRoots(); - - void setAddContentRoots(boolean flag); - void setAddSourceRoots(boolean flag); } diff --git a/python/openapi/src/com/jetbrains/python/run/PythonRunParams.java b/python/openapi/src/com/jetbrains/python/run/PythonRunParams.java new file mode 100644 index 000000000000..b9b2b98554d4 --- /dev/null +++ b/python/openapi/src/com/jetbrains/python/run/PythonRunParams.java @@ -0,0 +1,69 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.python.run; + +import com.intellij.openapi.module.Module; +import com.intellij.util.PathMappingSettings; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +/** + * @author traff + */ +public interface PythonRunParams { + String getInterpreterOptions(); + + void setInterpreterOptions(String interpreterOptions); + + String getWorkingDirectory(); + + void setWorkingDirectory(String workingDirectory); + + @Nullable + String getSdkHome(); + + void setSdkHome(String sdkHome); + + void setModule(Module module); + + String getModuleName(); + + boolean isUseModuleSdk(); + + void setUseModuleSdk(boolean useModuleSdk); + + boolean isPassParentEnvs(); + + void setPassParentEnvs(boolean passParentEnvs); + + Map getEnvs(); + + void setEnvs(Map envs); + + @Nullable + PathMappingSettings getMappingSettings(); + + void setMappingSettings(@Nullable PathMappingSettings mappingSettings); + + boolean shouldAddContentRoots(); + + boolean shouldAddSourceRoots(); + + void setAddContentRoots(boolean flag); + + void setAddSourceRoots(boolean flag); +} diff --git a/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java b/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java index 1a9c3435a7c9..cdfb3d108384 100644 --- a/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java +++ b/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java @@ -148,7 +148,7 @@ public class SphinxBaseCommand { ReSTService service = ReSTService.getInstance(module); cmd.setWorkDirectory(service.getWorkdir().isEmpty()? module.getProject().getBaseDir().getPath(): service.getWorkdir()); - PythonCommandLineState.createStandardGroupsIn(cmd); + PythonCommandLineState.createStandardGroups(cmd); ParamsGroup script_params = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT); assert script_params != null; diff --git a/python/src/com/jetbrains/python/PythonHelpersLocator.java b/python/src/com/jetbrains/python/PythonHelpersLocator.java index 38f8187e0627..1580694ca9ae 100644 --- a/python/src/com/jetbrains/python/PythonHelpersLocator.java +++ b/python/src/com/jetbrains/python/PythonHelpersLocator.java @@ -31,7 +31,8 @@ import java.util.Map; public enum PythonHelpersLocator implements PythonHelper { COVERAGEPY("", "coveragepy"), COVERAGE("run_coverage", "coverage"), DEBUGGER("pydevd", "pydev"), - CONSOLE("pydevconsole", "pydev"); + CONSOLE("pydevconsole", "pydev"), + RUN_IN_CONSOLE("pydev_run_in_console", "pydev"); @NotNull private PathPythonHelper findModule(String moduleName, String path) { diff --git a/python/src/com/jetbrains/python/console/PyConsoleOptions.java b/python/src/com/jetbrains/python/console/PyConsoleOptions.java index 1bf857347dc0..64f0dd111fe8 100644 --- a/python/src/com/jetbrains/python/console/PyConsoleOptions.java +++ b/python/src/com/jetbrains/python/console/PyConsoleOptions.java @@ -17,12 +17,15 @@ package com.jetbrains.python.console; import com.google.common.collect.Maps; import com.intellij.openapi.components.*; +import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; import com.intellij.util.PathMappingSettings; import com.intellij.util.containers.ComparatorUtil; import com.intellij.util.xmlb.annotations.*; import com.jetbrains.python.run.AbstractPyCommonOptionsForm; +import com.jetbrains.python.run.AbstractPythonRunConfigurationParams; +import com.jetbrains.python.run.PythonRunParams; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -84,7 +87,7 @@ public class PyConsoleOptions implements PersistentStateComponent envs, @NotNull final Project project) { @@ -294,7 +293,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory environmentVariables, - int[] ports) { - final ArrayList args = new ArrayList(); - args.add(sdk.getHomePath()); - final String versionString = sdk.getVersionString(); - if (versionString == null || !versionString.toLowerCase().contains("jython")) { - args.add("-u"); - } - args.add(FileUtil.toSystemDependentName(PythonHelpersLocator.getHelperPath(PYDEV_PYDEVCONSOLE_PY))); + protected GeneralCommandLine createCommandLine(@NotNull final Sdk sdk, + @NotNull final Map environmentVariables, + int[] ports) { + return doCreateConsoleCmdLine(ports, PythonHelpersLocator.CONSOLE); + } + + @NotNull + protected GeneralCommandLine doCreateConsoleCmdLine(int[] ports, PythonHelpersLocator helpersLocator) { + PyConsoleOptions.PyConsoleSettings settings = PyConsoleOptions.getInstance(getProject()).getPythonConsoleSettings(); + + GeneralCommandLine cmd = PythonCommandLineState.createPythonCommandLine(getProject(), settings); + cmd.withWorkDirectory(getWorkingDir()); + + ParamsGroup group = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT); + helpersLocator.addToGroup(group, cmd); + for (int port : ports) { - args.add(String.valueOf(port)); + group.addParameter(String.valueOf(port)); } - return new CommandLineArgumentsProvider() { - @Override - public String[] getArguments() { - return ArrayUtil.toStringArray(args); - } - @Override - public boolean passParentEnvs() { - return false; - } - - @Override - public Map getAdditionalEnvs() { - return addDefaultEnvironments(sdk, environmentVariables, getProject()); - } - }; + return cmd; } @Override @@ -421,19 +412,18 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory envs = myCommandLineArgumentsProvider.getAdditionalEnvs(); - if (envs != null) { - EncodingEnvironmentUtil.fixDefaultEncodingIfMac(envs, getProject()); - } - final Process server = ProcessRunner - .createProcess(getWorkingDir(), envs, myCommandLineArgumentsProvider.getArguments()); + myCommandLine = myGeneralCommandLine.getCommandLineString(); + Map envs = myGeneralCommandLine.getEnvironment(); + EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myGeneralCommandLine.getCharset()); + + final Process server = myGeneralCommandLine.createProcess(); + try { myPydevConsoleCommunication = new PydevConsoleCommunication(getProject(), myPorts[0], server, myPorts[1]); } @@ -1007,7 +997,8 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory pythonPath = PythonCommandLineState.collectPythonPath(module, settingsProvider.addContentRoots(), - settingsProvider.addSourceRoots()); + Collection pythonPath = PythonCommandLineState.collectPythonPath(module, settingsProvider.shouldAddContentRoots(), + settingsProvider.shouldAddSourceRoots()); if (mappingSettings != null) { pythonPath = mappingSettings.convertToRemote(pythonPath); diff --git a/python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java b/python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java index 2957987d3734..0ed73cdb56af 100644 --- a/python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java +++ b/python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java @@ -436,4 +436,10 @@ public abstract class AbstractPythonRunConfiguration env = myConfig.getEnvs(); if (env == null) { env = new HashMap(); @@ -264,14 +273,15 @@ public abstract class PythonCommandLineState extends CommandLineState { env = new HashMap(env); } - addPredefinedEnvironmentVariables(env, myConfig.isPassParentEnvs()); + setupEncodingEnvs(env, commandLine.getCharset()); + addCommonEnvironmentVariables(env); commandLine.getEnvironment().clear(); commandLine.getEnvironment().putAll(env); commandLine.setPassParentEnvironment(myConfig.isPassParentEnvs()); - buildPythonPath(commandLine, myConfig.isPassParentEnvs()); + buildPythonPath(project, commandLine, myConfig); } protected static void addCommonEnvironmentVariables(Map env) { @@ -279,19 +289,19 @@ public abstract class PythonCommandLineState extends CommandLineState { env.put("PYCHARM_HOSTED", "1"); } - public void addPredefinedEnvironmentVariables(Map envs, boolean passParentEnvs) { - final PythonSdkFlavor flavor = PythonSdkFlavor.getFlavor(myConfig.getInterpreterPath()); - if (flavor != null) { - flavor.addPredefinedEnvironmentVariables(envs, myConfig.getProject()); - } + public void customizeEnvironmentVars(Map envs, boolean passParentEnvs) { } - private void buildPythonPath(GeneralCommandLine commandLine, boolean passParentEnvs) { - Sdk pythonSdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath()); + private static void setupEncodingEnvs(Map envs, Charset charset) { + PythonSdkFlavor.setupEncodingEnvs(envs, charset); + } + + private static void buildPythonPath(Project project, GeneralCommandLine commandLine, PythonRunParams config) { + Sdk pythonSdk = PythonSdkType.findSdkByPath(config.getSdkHome()); if (pythonSdk != null) { List pathList = Lists.newArrayList(getAddedPaths(pythonSdk)); - pathList.addAll(collectPythonPath()); - initPythonPath(commandLine, passParentEnvs, pathList, myConfig.getInterpreterPath()); + pathList.addAll(collectPythonPath(project, config)); + initPythonPath(commandLine, config.isPassParentEnvs(), pathList, config.getSdkHome()); } } @@ -344,16 +354,14 @@ public abstract class PythonCommandLineState extends CommandLineState { } } - protected Collection collectPythonPath() { - final Module module = myConfig.getModule(); - Set pythonPath = Sets.newHashSet(collectPythonPath(module, myConfig.shouldAddContentRoots(), myConfig.shouldAddSourceRoots())); + protected static Collection collectPythonPath(Project project, PythonRunParams config) { + final Module module = getModule(project, config); - if (isDebug() && getSdkFlavor() instanceof JythonSdkFlavor) { //that fixes Jython problem changing sys.argv on execfile, see PY-8164 - pythonPath.add(PythonHelpersLocator.getHelperPath("pycharm")); - pythonPath.add(PythonHelpersLocator.getHelperPath("pydev")); - } + return Sets.newHashSet(collectPythonPath(module, config.shouldAddContentRoots(), config.shouldAddSourceRoots())); + } - return pythonPath; + private static Module getModule(Project project, PythonRunParams config) { + return ModuleManager.getInstance(project).findModuleByName(config.getModuleName()); } @NotNull @@ -448,9 +456,23 @@ public abstract class PythonCommandLineState extends CommandLineState { } } - protected void setRunnerPath(GeneralCommandLine commandLine) throws ExecutionException { - String interpreterPath = getInterpreterPath(); - commandLine.setExePath(FileUtil.toSystemDependentName(interpreterPath)); + protected static void setRunnerPath(Project project, GeneralCommandLine commandLine, PythonRunParams config) { + String interpreterPath = getInterpreterPath(project, config); + if (StringUtil.isNotEmpty(interpreterPath)) { + commandLine.setExePath(FileUtil.toSystemDependentName(interpreterPath)); + } + } + + @Nullable + public static String getInterpreterPath(Project project, PythonRunParams config) { + String sdkHome = config.getSdkHome(); + if (config.isUseModuleSdk() || StringUtil.isEmpty(sdkHome)) { + Sdk sdk = PythonSdkType.findPythonSdk(getModule(project, config)); + if (sdk == null) return null; + sdkHome = sdk.getHomePath(); + } + + return sdkHome; } protected String getInterpreterPath() throws ExecutionException { diff --git a/python/src/com/jetbrains/python/run/PythonScriptCommandLineState.java b/python/src/com/jetbrains/python/run/PythonScriptCommandLineState.java index ecc47133732f..e92f52a59682 100644 --- a/python/src/com/jetbrains/python/run/PythonScriptCommandLineState.java +++ b/python/src/com/jetbrains/python/run/PythonScriptCommandLineState.java @@ -24,21 +24,19 @@ import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.ParametersList; import com.intellij.execution.configurations.ParamsGroup; import com.intellij.execution.executors.DefaultDebugExecutor; -import com.intellij.execution.process.CommandLineArgumentsProvider; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ArrayUtil; import com.jetbrains.python.PythonHelpersLocator; import com.jetbrains.python.console.PyConsoleType; import com.jetbrains.python.console.PydevConsoleRunner; +import com.jetbrains.python.sdk.PythonEnvUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -127,46 +125,22 @@ public class PythonScriptCommandLineState extends PythonCommandLineState { } @Override - protected CommandLineArgumentsProvider createCommandLineArgumentsProvider(final Sdk sdk, - final Map environmentVariables, - int[] ports) { - final ArrayList args = new ArrayList(); - args.add(sdk.getHomePath()); - final String versionString = sdk.getVersionString(); - if (versionString == null || !versionString.toLowerCase().contains("jython")) { - args.add("-u"); - } - args.add(FileUtil.toSystemDependentName(PythonHelpersLocator.getHelperPath("pydev/pydev_run_in_console.py"))); - for (int port : ports) { - args.add(String.valueOf(port)); - } + protected GeneralCommandLine createCommandLine(@NotNull Sdk sdk, + @NotNull Map environmentVariables, + int[] ports) { + GeneralCommandLine consoleCmdLine = doCreateConsoleCmdLine(ports, PythonHelpersLocator.RUN_IN_CONSOLE); - try { - final GeneralCommandLine cmd = generateCommandLine(myPatchers); - args.addAll(cmd.getParametersList().getList()); + final GeneralCommandLine cmd = generateCommandLine(myPatchers); - return new CommandLineArgumentsProvider() { - @Override - public String[] getArguments() { - return ArrayUtil.toStringArray(args); - } + ParamsGroup group = consoleCmdLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT); + assert group != null; + group.addParameters(cmd.getParametersList().getList()); - @Override - public boolean passParentEnvs() { - return false; - } + PythonEnvUtil.mergePythonPath(consoleCmdLine.getEnvironment(), cmd.getEnvironment()); - @Override - public Map getAdditionalEnvs() { - Map map = addDefaultEnvironments(sdk, environmentVariables,getProject()); - map.putAll(cmd.getEnvironment()); - return map; - } - }; - } - catch (Exception e) { - throw new IllegalStateException(e); - } + consoleCmdLine.getEnvironment().putAll(cmd.getEnvironment()); + + return consoleCmdLine; } } } diff --git a/python/src/com/jetbrains/python/run/PythonTask.java b/python/src/com/jetbrains/python/run/PythonTask.java index 3ddd6a30969e..a22af15d6448 100644 --- a/python/src/com/jetbrains/python/run/PythonTask.java +++ b/python/src/com/jetbrains/python/run/PythonTask.java @@ -139,7 +139,7 @@ public class PythonTask { homePath = FileUtil.toSystemDependentName(homePath); } - PythonCommandLineState.createStandardGroupsIn(cmd); + PythonCommandLineState.createStandardGroups(cmd); ParamsGroup scriptParams = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT); assert scriptParams != null; diff --git a/python/src/com/jetbrains/python/sdk/PythonEnvUtil.java b/python/src/com/jetbrains/python/sdk/PythonEnvUtil.java index 7b4184fd00a0..75319d7acc97 100644 --- a/python/src/com/jetbrains/python/sdk/PythonEnvUtil.java +++ b/python/src/com/jetbrains/python/sdk/PythonEnvUtil.java @@ -86,6 +86,14 @@ public class PythonEnvUtil { addPathToEnv(env, PYTHONPATH, value); } + public static void mergePythonPath(@NotNull Map from, @NotNull Map to) { + String value = from.get(PYTHONPATH); + if (value != null) { + Set paths = Sets.newHashSet(value.split(File.pathSeparator)); + addToPythonPath(to, paths); + } + } + @NotNull public static Map setPythonDontWriteBytecode(@NotNull Map env) { env.put(PYTHONDONTWRITEBYTECODE, "1"); diff --git a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java index 3ecaf40ad0f6..c68e6bdff8b4 100644 --- a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java +++ b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java @@ -208,10 +208,8 @@ public abstract class PythonSdkFlavor { PythonEnvUtil.addPathToEnv(envs, key, value); } - @SuppressWarnings({"MethodMayBeStatic"}) - public void addPredefinedEnvironmentVariables(Map envs, @NotNull Project project) { - Charset defaultCharset = EncodingProjectManager.getInstance(project).getDefaultCharset(); - final String encoding = defaultCharset.name(); + public static void setupEncodingEnvs(Map envs, @NotNull Charset charset) { + final String encoding = charset.name(); PythonEnvUtil.setPythonIOEncoding(envs, encoding); } diff --git a/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java b/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java index 0a178153821b..1ee7b479b32a 100644 --- a/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java +++ b/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java @@ -122,19 +122,19 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction { } @Override - protected void addAfterParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addAfterParameters(GeneralCommandLine cmd) { myState.addAfterParameters(cmd); } @Override - protected void addBeforeParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addBeforeParameters(GeneralCommandLine cmd) { myState.addBeforeParameters(cmd); } @Override - public void addPredefinedEnvironmentVariables(Map envs, boolean passParentEnvs) { - myState.addPredefinedEnvironmentVariables(envs, - passParentEnvs); + public void customizeEnvironmentVars(Map envs, boolean passParentEnvs) { + myState.customizeEnvironmentVars(envs, + passParentEnvs); } } } diff --git a/python/src/com/jetbrains/python/testing/PythonTestCommandLineStateBase.java b/python/src/com/jetbrains/python/testing/PythonTestCommandLineStateBase.java index efd51aaf130b..d4ccd790f7c0 100644 --- a/python/src/com/jetbrains/python/testing/PythonTestCommandLineStateBase.java +++ b/python/src/com/jetbrains/python/testing/PythonTestCommandLineStateBase.java @@ -92,7 +92,7 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt } @Override - public GeneralCommandLine generateCommandLine() throws ExecutionException { + public GeneralCommandLine generateCommandLine() { GeneralCommandLine cmd = super.generateCommandLine(); setWorkingDirectory(cmd); @@ -154,10 +154,10 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt return executionResult; } - protected void addBeforeParameters(GeneralCommandLine cmd) throws ExecutionException {} - protected void addAfterParameters(GeneralCommandLine cmd) throws ExecutionException {} + protected void addBeforeParameters(GeneralCommandLine cmd) {} + protected void addAfterParameters(GeneralCommandLine cmd) {} - protected void addTestRunnerParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addTestRunnerParameters(GeneralCommandLine cmd) { ParamsGroup script_params = cmd.getParametersList().getParamsGroup(GROUP_SCRIPT); assert script_params != null; script_params.addParameter(new File(PythonHelpersLocator.getHelpersRoot(), getRunner()).getAbsolutePath()); @@ -167,8 +167,8 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt } @Override - public void addPredefinedEnvironmentVariables(Map envs, boolean passParentEnvs) { - super.addPredefinedEnvironmentVariables(envs, passParentEnvs); + public void customizeEnvironmentVars(Map envs, boolean passParentEnvs) { + super.customizeEnvironmentVars(envs, passParentEnvs); envs.put("PYCHARM_HELPERS_DIR", PythonHelpersLocator.getHelperPath("pycharm")); } diff --git a/python/src/com/jetbrains/python/testing/nosetest/PythonNoseTestCommandLineState.java b/python/src/com/jetbrains/python/testing/nosetest/PythonNoseTestCommandLineState.java index cd00594f1b9b..dfdd8c4d9285 100644 --- a/python/src/com/jetbrains/python/testing/nosetest/PythonNoseTestCommandLineState.java +++ b/python/src/com/jetbrains/python/testing/nosetest/PythonNoseTestCommandLineState.java @@ -70,7 +70,7 @@ public class PythonNoseTestCommandLineState extends PythonTestCommandLineStateBa } @Override - protected void addAfterParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addAfterParameters(GeneralCommandLine cmd) { ParamsGroup script_params = cmd.getParametersList().getParamsGroup(GROUP_SCRIPT); assert script_params != null; if (myConfig.useParam() && !StringUtil.isEmptyOrSpaces(myConfig.getParams())) diff --git a/python/src/com/jetbrains/python/testing/pytest/PyTestCommandLineState.java b/python/src/com/jetbrains/python/testing/pytest/PyTestCommandLineState.java index 7e3c4d51f270..8995b07029fb 100644 --- a/python/src/com/jetbrains/python/testing/pytest/PyTestCommandLineState.java +++ b/python/src/com/jetbrains/python/testing/pytest/PyTestCommandLineState.java @@ -43,7 +43,7 @@ public class PyTestCommandLineState extends PythonTestCommandLineStateBase { } @Override - protected void addBeforeParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addBeforeParameters(GeneralCommandLine cmd) { ParamsGroup script_params = cmd.getParametersList().getParamsGroup(GROUP_SCRIPT); assert script_params != null; script_params.addParameters("-p", "pytest_teamcity"); @@ -62,7 +62,7 @@ public class PyTestCommandLineState extends PythonTestCommandLineStateBase { } @Override - protected void addAfterParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addAfterParameters(GeneralCommandLine cmd) { ParamsGroup script_params = cmd.getParametersList().getParamsGroup(GROUP_SCRIPT); assert script_params != null; String params = myConfiguration.getParams(); diff --git a/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestCommandLineState.java b/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestCommandLineState.java index 90b0f5b4cdbe..761a48686df0 100644 --- a/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestCommandLineState.java +++ b/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestCommandLineState.java @@ -84,7 +84,7 @@ public class PythonUnitTestCommandLineState extends } @Override - protected void addAfterParameters(GeneralCommandLine cmd) throws ExecutionException { + protected void addAfterParameters(GeneralCommandLine cmd) { ParamsGroup script_params = cmd.getParametersList().getParamsGroup(GROUP_SCRIPT); assert script_params != null; if (myConfig.useParam() && !StringUtil.isEmptyOrSpaces(myConfig.getParams()))