mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-12313 Incorrect __file__ value when running tests in a folder on Windows
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.jetbrains.python.testing.attest;
|
||||
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.jetbrains.python.testing.PythonTestCommandLineStateBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -41,24 +42,27 @@ public class PythonAtTestCommandLineState extends PythonTestCommandLineStateBase
|
||||
protected List<String> getTestSpecs() {
|
||||
List<String> specs = new ArrayList<String>();
|
||||
|
||||
final String scriptName = FileUtil.toSystemDependentName(myConfig.getScriptName());
|
||||
switch (myConfig.getTestType()) {
|
||||
case TEST_SCRIPT:
|
||||
specs.add(myConfig.getScriptName());
|
||||
specs.add(scriptName);
|
||||
break;
|
||||
case TEST_CLASS:
|
||||
specs.add(myConfig.getScriptName() + "::" + myConfig.getClassName());
|
||||
specs.add(scriptName + "::" + myConfig.getClassName());
|
||||
break;
|
||||
case TEST_METHOD:
|
||||
specs.add(myConfig.getScriptName() + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
|
||||
specs.add(scriptName + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
|
||||
break;
|
||||
case TEST_FOLDER:
|
||||
if (!myConfig.getPattern().isEmpty())
|
||||
specs.add(myConfig.getFolderName() + "/" + ";" + myConfig.getPattern());
|
||||
final String folderName = FileUtil.toSystemDependentName(myConfig.getFolderName() + "/");
|
||||
if (!myConfig.getPattern().isEmpty()) {
|
||||
specs.add(folderName + ";" + myConfig.getPattern());
|
||||
}
|
||||
else
|
||||
specs.add(myConfig.getFolderName() + "/");
|
||||
specs.add(folderName);
|
||||
break;
|
||||
case TEST_FUNCTION:
|
||||
specs.add(myConfig.getScriptName() + "::::" + myConfig.getMethodName());
|
||||
specs.add(scriptName + "::::" + myConfig.getMethodName());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown test type: " + myConfig.getTestType());
|
||||
|
||||
+7
-5
@@ -19,6 +19,7 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.ParamsGroup;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.jetbrains.python.testing.PythonTestCommandLineStateBase;
|
||||
|
||||
@@ -45,21 +46,22 @@ public class PythonNoseTestCommandLineState extends PythonTestCommandLineStateBa
|
||||
protected List<String> getTestSpecs() {
|
||||
List<String> specs = new ArrayList<String>();
|
||||
|
||||
final String scriptName = FileUtil.toSystemDependentName(myConfig.getScriptName());
|
||||
switch (myConfig.getTestType()) {
|
||||
case TEST_SCRIPT:
|
||||
specs.add(myConfig.getScriptName());
|
||||
specs.add(scriptName);
|
||||
break;
|
||||
case TEST_CLASS:
|
||||
specs.add(myConfig.getScriptName() + "::" + myConfig.getClassName());
|
||||
specs.add(scriptName + "::" + myConfig.getClassName());
|
||||
break;
|
||||
case TEST_METHOD:
|
||||
specs.add(myConfig.getScriptName() + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
|
||||
specs.add(scriptName + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
|
||||
break;
|
||||
case TEST_FOLDER:
|
||||
specs.add(myConfig.getFolderName() + "/");
|
||||
specs.add(FileUtil.toSystemDependentName(myConfig.getFolderName() + "/"));
|
||||
break;
|
||||
case TEST_FUNCTION:
|
||||
specs.add(myConfig.getScriptName() + "::::" + myConfig.getMethodName());
|
||||
specs.add(scriptName + "::::" + myConfig.getMethodName());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown test type: " + myConfig.getTestType());
|
||||
|
||||
+3
-2
@@ -65,11 +65,12 @@ public class PythonUnitTestCommandLineState extends
|
||||
specs.add(scriptName + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
|
||||
break;
|
||||
case TEST_FOLDER:
|
||||
final String folderName = FileUtil.toSystemDependentName(myConfig.getFolderName() + "/");
|
||||
if (!StringUtil.isEmpty(myConfig.getPattern()) && myConfig.usePattern()) {
|
||||
specs.add(myConfig.getFolderName() + "/" + ";" + myConfig.getPattern());
|
||||
specs.add(folderName + ";" + myConfig.getPattern());
|
||||
}
|
||||
else {
|
||||
specs.add(myConfig.getFolderName() + "/");
|
||||
specs.add(folderName);
|
||||
}
|
||||
break;
|
||||
case TEST_FUNCTION:
|
||||
|
||||
Reference in New Issue
Block a user