From 95ce9fdc07b9e814a3de52beb4497f8d86599708 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Mon, 3 Jun 2013 14:19:21 +0400 Subject: [PATCH 1/2] provide scope to detect location more precisely (IDEA-107895) --- .../jetbrains/python/testing/PyRerunFailedTestsAction.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java b/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java index 0e3ddfcd2c4c..adcdcef1c4b9 100644 --- a/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java +++ b/python/src/com/jetbrains/python/testing/PyRerunFailedTestsAction.java @@ -15,6 +15,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ComponentContainer; 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; @@ -91,7 +92,7 @@ public class PyRerunFailedTestsAction extends AbstractRerunFailedTestsAction { List failedTests = getFailedTests(myProject); for (AbstractTestProxy failedTest : failedTests) { if (failedTest.isLeaf()) { - final Location location = failedTest.getLocation(myProject); + final Location location = failedTest.getLocation(myProject, myConsoleProperties.getScope()); if (location != null) { final PsiElement element = location.getPsiElement(); @@ -138,7 +139,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()); From 7b88d410c1e8eb1f635a08af7089f14c840e9149 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Mon, 3 Jun 2013 20:24:16 +0200 Subject: [PATCH 2/2] Convert line separators in test. --- python/testSrc/com/jetbrains/python/PyConsoleIndentTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/testSrc/com/jetbrains/python/PyConsoleIndentTest.java b/python/testSrc/com/jetbrains/python/PyConsoleIndentTest.java index f1ebbb35a081..73560f304f8d 100644 --- a/python/testSrc/com/jetbrains/python/PyConsoleIndentTest.java +++ b/python/testSrc/com/jetbrains/python/PyConsoleIndentTest.java @@ -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);