mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
Conflicts: python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java
This commit is contained in:
@@ -16,13 +16,16 @@ 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.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.django.testRunner.DjangoTestUtil;
|
||||
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;
|
||||
|
||||
@@ -94,29 +97,30 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
|
||||
List<AbstractTestProxy> failedTests = getFailedTests(myProject);
|
||||
for (AbstractTestProxy failedTest : failedTests) {
|
||||
if (failedTest.isLeaf()) {
|
||||
final Location location = failedTest.getLocation(myProject);
|
||||
if (location == null) continue;
|
||||
final Location location = failedTest.getLocation(myProject, myConsoleProperties.getScope());
|
||||
if (location != null) {
|
||||
final PsiElement element = location.getPsiElement();
|
||||
|
||||
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)
|
||||
path += "::" + pyFunction.getName();
|
||||
|
||||
if (!specs.contains(path))
|
||||
specs.add(path);
|
||||
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 = location.getVirtualFile().getCanonicalPath();
|
||||
if (pyClass != null)
|
||||
path += "::" + pyClass.getName();
|
||||
if (pyFunction != null)
|
||||
path += "::" + pyFunction.getName();
|
||||
|
||||
if (!specs.contains(path))
|
||||
specs.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,7 +147,7 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Filter getFilter(Project project) {
|
||||
protected Filter getFilter(Project project, GlobalSearchScope searchScope) {
|
||||
return new Filter() {
|
||||
public boolean shouldAccept(final AbstractTestProxy test) {
|
||||
boolean ignored = (test.getMagnitude() == TestStateInfo.Magnitude.IGNORED_INDEX.getValue());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jetbrains.python;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.jetbrains.python.console.PyConsoleIndentUtil;
|
||||
|
||||
@@ -48,7 +49,8 @@ public class PyConsoleIndentTest extends UsefulTestCase {
|
||||
try {
|
||||
String fileText = FileUtil.loadFile(new File(getTestDataPath() + name + ".py"));
|
||||
String expected = FileUtil.loadFile(new File(getTestDataPath() + name + ".after.py"));
|
||||
assertEquals(expected, PyConsoleIndentUtil.normalize(fileText, indent));
|
||||
assertEquals(StringUtil.convertLineSeparators(expected), StringUtil.convertLineSeparators(
|
||||
PyConsoleIndentUtil.normalize(fileText, indent)));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
Reference in New Issue
Block a user