mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-9527 unittests miss tcunittest
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import sys, os
|
||||
import imp
|
||||
|
||||
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
|
||||
if sys.path[0] != helpers_dir:
|
||||
sys.path.insert(0, helpers_dir)
|
||||
|
||||
from tcunittest import TeamcityTestResult
|
||||
|
||||
from pycharm_run_utils import import_system_module
|
||||
|
||||
@@ -2,6 +2,10 @@ import imp
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
|
||||
if sys.path[0] != helpers_dir:
|
||||
sys.path.insert(0, helpers_dir)
|
||||
|
||||
from tcunittest import TeamcityTestResult
|
||||
from tcmessages import TeamcityServiceMessages
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import sys
|
||||
|
||||
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
|
||||
if sys.path[0] != helpers_dir:
|
||||
sys.path.insert(0, helpers_dir)
|
||||
|
||||
from nose_utils import TeamcityPlugin
|
||||
|
||||
from pycharm_run_utils import debug, import_system_module
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
from tcmessages import TeamcityServiceMessages
|
||||
import os
|
||||
|
||||
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
|
||||
if sys.path[0] != helpers_dir:
|
||||
sys.path.insert(0, helpers_dir)
|
||||
|
||||
from tcmessages import TeamcityServiceMessages
|
||||
from pycharm_run_utils import adjust_sys_path
|
||||
|
||||
adjust_sys_path(False)
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import sys
|
||||
import imp
|
||||
import os
|
||||
|
||||
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
|
||||
if sys.path[0] != helpers_dir:
|
||||
sys.path.insert(0, helpers_dir)
|
||||
|
||||
from tcunittest import TeamcityTestRunner
|
||||
from nose_helper import TestLoader, ContextSuite
|
||||
from pycharm_run_utils import import_system_module
|
||||
|
||||
@@ -9,11 +9,13 @@ import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.testframework.AbstractTestProxy;
|
||||
import com.intellij.execution.testframework.Filter;
|
||||
import com.intellij.execution.testframework.TestFrameworkRunningModel;
|
||||
import com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction;
|
||||
import com.intellij.execution.testframework.sm.runner.states.TestStateInfo;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComponentContainer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.django.testRunner.DjangoTestUtil;
|
||||
@@ -21,7 +23,6 @@ import com.jetbrains.django.testRunner.DjangoTestsRunConfiguration;
|
||||
import com.jetbrains.python.psi.PyClass;
|
||||
import com.jetbrains.python.psi.PyFunction;
|
||||
import com.jetbrains.python.run.AbstractPythonRunConfiguration;
|
||||
import com.jetbrains.python.run.PythonCommandLineState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -39,8 +40,11 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MyRunProfile getRunProfile() {
|
||||
final AbstractPythonRunConfiguration configuration = (AbstractPythonRunConfiguration)getModel().getProperties().getConfiguration();
|
||||
final TestFrameworkRunningModel model = getModel();
|
||||
if (model == null) return null;
|
||||
final AbstractPythonRunConfiguration configuration = (AbstractPythonRunConfiguration)model.getProperties().getConfiguration();
|
||||
return new MyTestRunProfile(configuration);
|
||||
}
|
||||
|
||||
@@ -61,9 +65,8 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
|
||||
@Override
|
||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
|
||||
final AbstractPythonRunConfiguration configuration = ((AbstractPythonRunConfiguration)getPeer());
|
||||
final PythonCommandLineState state = new FailedPythonTestCommandLineStateBase(configuration, env,
|
||||
return new FailedPythonTestCommandLineStateBase(configuration, env,
|
||||
(PythonTestCommandLineStateBase)configuration.getState(executor, env));
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,19 +95,21 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
|
||||
for (AbstractTestProxy failedTest : failedTests) {
|
||||
if (failedTest.isLeaf()) {
|
||||
final Location location = failedTest.getLocation(myProject);
|
||||
if (location != null) {
|
||||
final PsiElement element = location.getPsiElement();
|
||||
if (location == null) continue;
|
||||
|
||||
if (getConfiguration() instanceof DjangoTestsRunConfiguration) {
|
||||
String appName = DjangoTestUtil.getAppNameForLocation(location.getModule(), location.getPsiElement());
|
||||
String target = DjangoTestUtil.buildTargetFromLocation(appName, element);
|
||||
if (target != null)
|
||||
specs.add(target);
|
||||
}
|
||||
else {
|
||||
PyClass pyClass = PsiTreeUtil.getParentOfType(element, PyClass.class, false);
|
||||
PyFunction pyFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class, false);
|
||||
String path = location.getVirtualFile().getCanonicalPath();
|
||||
final PsiElement element = location.getPsiElement();
|
||||
if (getConfiguration() instanceof DjangoTestsRunConfiguration) {
|
||||
String appName = DjangoTestUtil.getAppNameForLocation(location.getModule(), location.getPsiElement());
|
||||
String target = DjangoTestUtil.buildTargetFromLocation(appName, element);
|
||||
if (target != null)
|
||||
specs.add(target);
|
||||
}
|
||||
else {
|
||||
PyClass pyClass = PsiTreeUtil.getParentOfType(element, PyClass.class, false);
|
||||
PyFunction pyFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class, false);
|
||||
final VirtualFile virtualFile = location.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
String path = virtualFile.getCanonicalPath();
|
||||
if (pyClass != null)
|
||||
path += "::" + pyClass.getName();
|
||||
if (pyFunction != null)
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -126,6 +127,12 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt
|
||||
addAfterParameters(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPredefinedEnvironmentVariables(Map<String, String> envs, boolean passParentEnvs) {
|
||||
super.addPredefinedEnvironmentVariables(envs, passParentEnvs);
|
||||
envs.put("PYCHARM_HELPERS_DIR", PythonHelpersLocator.getHelperPath("pycharm"));
|
||||
}
|
||||
|
||||
protected abstract String getRunner();
|
||||
protected abstract List<String> getTestSpecs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user