mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-6955 Unused import not greyed out if also failing (test refactored)
This commit is contained in:
@@ -24,11 +24,25 @@ public abstract class PyInspectionTestCase extends PyTestCase {
|
||||
* Launches test. To be called by test author
|
||||
*/
|
||||
protected void doTest() {
|
||||
myFixture.configureByFile("inspections/" + getInspectionClass().getSimpleName() + "/" + getTestName(true) + ".py");
|
||||
myFixture.configureByFile(getTestDirectory(true) + ".py");
|
||||
configureInspection();
|
||||
}
|
||||
|
||||
protected void doMultiFileTest(@NotNull String filename) {
|
||||
myFixture.copyDirectoryToProject(getTestDirectory(false), "");
|
||||
myFixture.configureFromTempProjectFile(filename);
|
||||
configureInspection();
|
||||
}
|
||||
|
||||
private void configureInspection() {
|
||||
myFixture.enableInspections(getInspectionClass());
|
||||
myFixture.checkHighlighting(isWarning(), isInfo(), isWeakWarning());
|
||||
}
|
||||
|
||||
private String getTestDirectory(boolean lowercaseFirstLetter) {
|
||||
return "inspections/" + getInspectionClass().getSimpleName() + "/" + getTestName(lowercaseFirstLetter);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isWeakWarning() {
|
||||
return true;
|
||||
|
||||
+9
-18
@@ -15,15 +15,14 @@
|
||||
*/
|
||||
package com.jetbrains.python.inspections;
|
||||
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.fixtures.PyInspectionTestCase;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class PyUnresolvedReferencesInspectionTest extends PyTestCase {
|
||||
private static final String TEST_DIRECTORY = "inspections/PyUnresolvedReferencesInspection/";
|
||||
public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
public void testSelfReference() {
|
||||
doTest();
|
||||
@@ -77,11 +76,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyTestCase {
|
||||
public void testTypeAssertions() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testUnresolvedImportedModule() { // PY-2075
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testSuperType() { // PY-2320
|
||||
doTest();
|
||||
}
|
||||
@@ -89,7 +88,7 @@ public class PyUnresolvedReferencesInspectionTest extends PyTestCase {
|
||||
public void testImportFunction() { // PY-1896
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testSuperclassAsLocal() { // PY-5427
|
||||
doTest();
|
||||
}
|
||||
@@ -336,17 +335,9 @@ public class PyUnresolvedReferencesInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(TEST_DIRECTORY + getTestName(true) + ".py");
|
||||
myFixture.enableInspections(PyUnresolvedReferencesInspection.class);
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
}
|
||||
|
||||
private void doMultiFileTest(@NotNull String filename) {
|
||||
final String testName = getTestName(false);
|
||||
myFixture.copyDirectoryToProject(TEST_DIRECTORY + testName, "");
|
||||
myFixture.configureFromTempProjectFile(filename);
|
||||
myFixture.enableInspections(PyUnresolvedReferencesInspection.class);
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
return PyUnresolvedReferencesInspection.class;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user