From 64a66563fbb06679812a7b465fbbf35d33a25dcd Mon Sep 17 00:00:00 2001 From: Stanislav Utikeev Date: Wed, 13 Nov 2019 20:06:49 +0300 Subject: [PATCH] Consistent naming for common Python tests and fixtures: (Python|Py)(Common|Platform?|Psi)(.+) GitOrigin-RevId: 648dc76cfd3edc5567f46eceaeaaa9afa5433331 --- ...onPyResolveTest.java => PyCommonResolveTest.java} | 8 ++++---- ...tionTest.java => PythonCommonCompletionTest.java} | 4 ++-- ...lveTestCase.java => PyCommonResolveTestCase.java} | 2 +- ...ture.kt => PythonCommonCodeInsightTestFixture.kt} | 2 +- ...PythonTestCase.java => PythonCommonTestCase.java} | 7 +++---- .../testSrc/com/jetbrains/python/PyResolveTest.java | 10 +++++----- .../com/jetbrains/python/PythonCompletionTest.java | 12 +++++------- ...re.kt => PythonPlatformCodeInsightTestFixture.kt} | 4 ++-- 8 files changed, 23 insertions(+), 26 deletions(-) rename python/python-common-tests/com/jetbrains/python/{CommonPyResolveTest.java => PyCommonResolveTest.java} (99%) rename python/python-common-tests/com/jetbrains/python/{CommonPythonCompletionTest.java => PythonCommonCompletionTest.java} (99%) rename python/python-common-tests/com/jetbrains/python/fixture/{PyResolveTestCase.java => PyCommonResolveTestCase.java} (98%) rename python/python-common-tests/com/jetbrains/python/fixture/{CommonPythonCodeInsightTestFixture.kt => PythonCommonCodeInsightTestFixture.kt} (97%) rename python/python-common-tests/com/jetbrains/python/fixture/{CommonPythonTestCase.java => PythonCommonTestCase.java} (98%) rename python/testSrc/com/jetbrains/python/fixtures/{PlatformPythonCodeInsightTestFixture.kt => PythonPlatformCodeInsightTestFixture.kt} (97%) diff --git a/python/python-common-tests/com/jetbrains/python/CommonPyResolveTest.java b/python/python-common-tests/com/jetbrains/python/PyCommonResolveTest.java similarity index 99% rename from python/python-common-tests/com/jetbrains/python/CommonPyResolveTest.java rename to python/python-common-tests/com/jetbrains/python/PyCommonResolveTest.java index 030b6ea4a25d..acce0c805cfc 100644 --- a/python/python-common-tests/com/jetbrains/python/CommonPyResolveTest.java +++ b/python/python-common-tests/com/jetbrains/python/PyCommonResolveTest.java @@ -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)); } ); diff --git a/python/python-common-tests/com/jetbrains/python/CommonPythonCompletionTest.java b/python/python-common-tests/com/jetbrains/python/PythonCommonCompletionTest.java similarity index 99% rename from python/python-common-tests/com/jetbrains/python/CommonPythonCompletionTest.java rename to python/python-common-tests/com/jetbrains/python/PythonCommonCompletionTest.java index da9d6df0cd7b..3d9d227d9a7c 100644 --- a/python/python-common-tests/com/jetbrains/python/CommonPythonCompletionTest.java +++ b/python/python-common-tests/com/jetbrains/python/PythonCommonCompletionTest.java @@ -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 { diff --git a/python/python-common-tests/com/jetbrains/python/fixture/PyResolveTestCase.java b/python/python-common-tests/com/jetbrains/python/fixture/PyCommonResolveTestCase.java similarity index 98% rename from python/python-common-tests/com/jetbrains/python/fixture/PyResolveTestCase.java rename to python/python-common-tests/com/jetbrains/python/fixture/PyCommonResolveTestCase.java index b955618ecd3e..6d5eade004d6 100644 --- a/python/python-common-tests/com/jetbrains/python/fixture/PyResolveTestCase.java +++ b/python/python-common-tests/com/jetbrains/python/fixture/PyCommonResolveTestCase.java @@ -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 = ""; protected PsiReference configureByFile(final String filePath) { diff --git a/python/python-common-tests/com/jetbrains/python/fixture/CommonPythonCodeInsightTestFixture.kt b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonCodeInsightTestFixture.kt similarity index 97% rename from python/python-common-tests/com/jetbrains/python/fixture/CommonPythonCodeInsightTestFixture.kt rename to python/python-common-tests/com/jetbrains/python/fixture/PythonCommonCodeInsightTestFixture.kt index 87768e44c2c4..eedd479271e7 100644 --- a/python/python-common-tests/com/jetbrains/python/fixture/CommonPythonCodeInsightTestFixture.kt +++ b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonCodeInsightTestFixture.kt @@ -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 diff --git a/python/python-common-tests/com/jetbrains/python/fixture/CommonPythonTestCase.java b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java similarity index 98% rename from python/python-common-tests/com/jetbrains/python/fixture/CommonPythonTestCase.java rename to python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java index 94ea61f813bc..6673048ba004 100644 --- a/python/python-common-tests/com/jetbrains/python/fixture/CommonPythonTestCase.java +++ b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java @@ -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 { diff --git a/python/testSrc/com/jetbrains/python/PyResolveTest.java b/python/testSrc/com/jetbrains/python/PyResolveTest.java index f3abe0fc6cde..c87323449573 100644 --- a/python/testSrc/com/jetbrains/python/PyResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyResolveTest.java @@ -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; } } diff --git a/python/testSrc/com/jetbrains/python/PythonCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java index 67ced4c0c08a..63a206c45ee4 100644 --- a/python/testSrc/com/jetbrains/python/PythonCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java @@ -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; } } diff --git a/python/testSrc/com/jetbrains/python/fixtures/PlatformPythonCodeInsightTestFixture.kt b/python/testSrc/com/jetbrains/python/fixtures/PythonPlatformCodeInsightTestFixture.kt similarity index 97% rename from python/testSrc/com/jetbrains/python/fixtures/PlatformPythonCodeInsightTestFixture.kt rename to python/testSrc/com/jetbrains/python/fixtures/PythonPlatformCodeInsightTestFixture.kt index afb51629a69e..461aa7f2f250 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/PlatformPythonCodeInsightTestFixture.kt +++ b/python/testSrc/com/jetbrains/python/fixtures/PythonPlatformCodeInsightTestFixture.kt @@ -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