Consistent naming for common Python tests and fixtures: (Python|Py)(Common|Platform?|Psi)(.+)

GitOrigin-RevId: 648dc76cfd3edc5567f46eceaeaaa9afa5433331
This commit is contained in:
Stanislav Utikeev
2019-12-03 15:11:09 +00:00
committed by intellij-monorepo-bot
parent e558bc568d
commit 64a66563fb
8 changed files with 23 additions and 26 deletions
@@ -7,7 +7,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
import com.jetbrains.python.fixture.PyResolveTestCase;
import com.jetbrains.python.fixture.PyCommonResolveTestCase;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyBuiltinCache;
import com.jetbrains.python.psi.impl.PyPsiUtils;
@@ -19,7 +19,7 @@ import com.jetbrains.python.pyi.PyiUtil;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
public abstract class CommonPyResolveTest extends PyResolveTestCase {
public abstract class PyCommonResolveTest extends PyCommonResolveTestCase {
@Override
protected PsiElement doResolve() {
@@ -29,7 +29,7 @@ public abstract class CommonPyResolveTest extends PyResolveTestCase {
private PsiReference findReferenceByMarker() {
myFixture.configureByFile("resolve/" + getTestName(false) + ".py");
return PyResolveTestCase.findReferenceByMarker(myFixture.getFile());
return PyCommonResolveTestCase.findReferenceByMarker(myFixture.getFile());
}
protected PsiElement resolve() {
@@ -53,7 +53,7 @@ public abstract class CommonPyResolveTest extends PyResolveTestCase {
LanguageLevel.getLatest(),
() -> {
myFixture.configureByText(PythonFileType.INSTANCE, text);
result.set(assertResolveResult(PyResolveTestCase.findReferenceByMarker(myFixture.getFile()).resolve(), cls, name));
result.set(assertResolveResult(PyCommonResolveTestCase.findReferenceByMarker(myFixture.getFile()).resolve(), cls, name));
}
);
@@ -9,7 +9,7 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.python.documentation.docstrings.DocStringFormat;
import com.jetbrains.python.fixture.CommonPythonTestCase;
import com.jetbrains.python.fixture.PythonCommonTestCase;
import com.jetbrains.python.psi.LanguageLevel;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
@@ -20,7 +20,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
public abstract class CommonPythonCompletionTest extends CommonPythonTestCase {
public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
@Override
protected void setUp() throws Exception {
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
public abstract class PyResolveTestCase extends CommonPythonTestCase {
public abstract class PyCommonResolveTestCase extends PythonCommonTestCase {
@NonNls protected static final String MARKER = "<ref>";
protected PsiReference configureByFile(final String filePath) {
@@ -11,7 +11,7 @@ import com.intellij.psi.PsiManager
import com.intellij.util.ThrowableRunnable
import com.jetbrains.python.PythonFileType
interface CommonPythonCodeInsightTestFixture {
interface PythonCommonCodeInsightTestFixture {
val tempDirRoot: VirtualFile
val project: Project
@@ -1,7 +1,6 @@
package com.jetbrains.python.fixture;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.intellij.openapi.roots.OrderRootType;
@@ -29,10 +28,10 @@ import org.junit.Assert;
import java.util.*;
import java.util.function.Consumer;
public abstract class CommonPythonTestCase extends TestCase {
protected CommonPythonCodeInsightTestFixture myFixture;
public abstract class PythonCommonTestCase extends TestCase {
protected PythonCommonCodeInsightTestFixture myFixture;
protected abstract CommonPythonCodeInsightTestFixture getFixture();
protected abstract PythonCommonCodeInsightTestFixture getFixture();
@Override
protected void setUp() throws Exception {
@@ -1,15 +1,15 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python;
import com.jetbrains.python.fixture.CommonPythonCodeInsightTestFixture;
import com.jetbrains.python.fixtures.PlatformPythonCodeInsightTestFixture;
import com.jetbrains.python.fixture.PythonCommonCodeInsightTestFixture;
import com.jetbrains.python.fixtures.PythonPlatformCodeInsightTestFixture;
public class PyResolveTest extends CommonPyResolveTest {
public class PyResolveTest extends PyCommonResolveTest {
private final CommonPythonCodeInsightTestFixture myBackingFixture = new PlatformPythonCodeInsightTestFixture();
private final PythonCommonCodeInsightTestFixture myBackingFixture = new PythonPlatformCodeInsightTestFixture();
@Override
protected CommonPythonCodeInsightTestFixture getFixture() {
protected PythonCommonCodeInsightTestFixture getFixture() {
return myBackingFixture;
}
}
@@ -2,13 +2,11 @@
package com.jetbrains.python;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.testFramework.TestDataPath;
import com.jetbrains.python.fixture.CommonPythonCodeInsightTestFixture;
import com.jetbrains.python.fixtures.PlatformPythonCodeInsightTestFixture;
import com.jetbrains.python.fixture.PythonCommonCodeInsightTestFixture;
import com.jetbrains.python.fixtures.PythonPlatformCodeInsightTestFixture;
@TestDataPath("$CONTENT_ROOT/../testData/completion")
public class PythonCompletionTest extends CommonPythonCompletionTest {
private final CommonPythonCodeInsightTestFixture myBackingFixture = new PlatformPythonCodeInsightTestFixture();
public class PythonCompletionTest extends PythonCommonCompletionTest {
private final PythonCommonCodeInsightTestFixture myBackingFixture = new PythonPlatformCodeInsightTestFixture();
@Override
protected void doTest() {
@@ -17,7 +15,7 @@ public class PythonCompletionTest extends CommonPythonCompletionTest {
}
@Override
protected CommonPythonCodeInsightTestFixture getFixture() {
protected PythonCommonCodeInsightTestFixture getFixture() {
return myBackingFixture;
}
}
@@ -17,12 +17,12 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture
import com.intellij.util.ThrowableRunnable
import com.jetbrains.python.PythonFileType
import com.jetbrains.python.PythonTestUtil
import com.jetbrains.python.fixture.CommonPythonCodeInsightTestFixture
import com.jetbrains.python.fixture.PythonCommonCodeInsightTestFixture
import junit.framework.TestCase.assertNotNull
import java.io.File
import java.lang.reflect.InvocationTargetException
class PlatformPythonCodeInsightTestFixture : CommonPythonCodeInsightTestFixture {
class PythonPlatformCodeInsightTestFixture : PythonCommonCodeInsightTestFixture {
private val myDelegateTestCase = PyDelegateTestCase()
private val myDelegateFixture: CodeInsightTestFixture
get() = myDelegateTestCase.myFixture