From 7ec5c11c9353a9770d0dc11fecb92bd7e2414325 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 10 Oct 2019 22:09:38 +0200 Subject: [PATCH] Don't depend on testFramework and make python-openapi not depend on lang GitOrigin-RevId: c34a51bb984110d087fdddeff41c304f362ba4fe --- .../intellij.platform.analysis.impl.iml | 3 +- .../packaging/PackageManagementService.java | 0 .../packaging/PackageVersionComparator.java | 0 .../webcore/packaging/RepoPackage.java | 0 python/openapi/intellij.python.community.iml | 10 ++- .../python/module/PyModuleService.java | 12 --- .../python/run/PyRunConfigurationFactory.java | 4 - .../intellij.python.psi.impl.iml | 2 +- .../application/impl/MockPsiApplication.kt | 9 +- .../openapi/project/impl/MockPsiProject.kt | 7 +- .../com/jetbrains/python/PythonMockSdk.java | 46 +++++----- .../python/fixtures/PyPsiResolveTestCase.kt | 7 +- .../python/fixtures/PyPsiTestCase.kt | 54 +++++++----- .../lexer/PyStringLiteralLexerTest.java | 59 ------------- .../python/module/MockPyModuleService.kt | 13 ++- .../python/module/PyModuleServiceEx.java | 17 ++++ .../python/module/PyModuleServiceImpl.java | 2 +- .../run/PyRunConfigurationFactoryEx.java | 10 +++ .../run/PyRunConfigurationFactoryImpl.java | 2 +- .../python/PyStringLiteralLexerTest.java | 46 ++++++++++ .../python}/PythonCompletionTest.java | 4 +- .../jetbrains/python}/PythonLexerTest.java | 19 +---- .../PyStringFormatParserTest.java | 84 ++++++++----------- .../breadcrumbs}/PythonParsingTest.java | 18 +--- .../console/PythonInConsoleParsingTest.kt | 2 +- .../python/fixtures/PyLexerTestCase.java | 0 .../fixtures/PyLightProjectDescriptor.java | 0 .../jetbrains/python/fixtures/PyTestCase.java | 0 28 files changed, 195 insertions(+), 235 deletions(-) rename platform/{lang-impl => analysis-impl}/src/com/intellij/webcore/packaging/PackageManagementService.java (100%) rename platform/{lang-impl => analysis-impl}/src/com/intellij/webcore/packaging/PackageVersionComparator.java (100%) rename platform/{lang-impl => analysis-impl}/src/com/intellij/webcore/packaging/RepoPackage.java (100%) delete mode 100644 python/python-psi-impl/test/com/jetbrains/python/lexer/PyStringLiteralLexerTest.java create mode 100644 python/src/com/jetbrains/python/module/PyModuleServiceEx.java create mode 100644 python/src/com/jetbrains/python/run/PyRunConfigurationFactoryEx.java create mode 100644 python/testSrc/com/jetbrains/python/PyStringLiteralLexerTest.java rename python/{python-psi-impl/test/com/jetbrains/python/completion => testSrc/com/jetbrains/python}/PythonCompletionTest.java (99%) rename python/{python-psi-impl/test/com/jetbrains/python/lexer => testSrc/com/jetbrains/python}/PythonLexerTest.java (97%) rename python/{python-psi-impl/test/com/jetbrains/python/parsing => testSrc/com/jetbrains/python/breadcrumbs}/PyStringFormatParserTest.java (85%) rename python/{python-psi-impl/test/com/jetbrains/python/parsing => testSrc/com/jetbrains/python/breadcrumbs}/PythonParsingTest.java (97%) rename python/{python-psi-impl/test => testSrc}/com/jetbrains/python/fixtures/PyLexerTestCase.java (100%) rename python/{python-psi-impl/test => testSrc}/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java (100%) rename python/{python-psi-impl/test => testSrc}/com/jetbrains/python/fixtures/PyTestCase.java (100%) diff --git a/platform/analysis-impl/intellij.platform.analysis.impl.iml b/platform/analysis-impl/intellij.platform.analysis.impl.iml index f9ed5f01ebd4..bc8a5562eaca 100644 --- a/platform/analysis-impl/intellij.platform.analysis.impl.iml +++ b/platform/analysis-impl/intellij.platform.analysis.impl.iml @@ -20,5 +20,6 @@ + - \ No newline at end of file + diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/PackageManagementService.java b/platform/analysis-impl/src/com/intellij/webcore/packaging/PackageManagementService.java similarity index 100% rename from platform/lang-impl/src/com/intellij/webcore/packaging/PackageManagementService.java rename to platform/analysis-impl/src/com/intellij/webcore/packaging/PackageManagementService.java diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/PackageVersionComparator.java b/platform/analysis-impl/src/com/intellij/webcore/packaging/PackageVersionComparator.java similarity index 100% rename from platform/lang-impl/src/com/intellij/webcore/packaging/PackageVersionComparator.java rename to platform/analysis-impl/src/com/intellij/webcore/packaging/PackageVersionComparator.java diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/RepoPackage.java b/platform/analysis-impl/src/com/intellij/webcore/packaging/RepoPackage.java similarity index 100% rename from platform/lang-impl/src/com/intellij/webcore/packaging/RepoPackage.java rename to platform/analysis-impl/src/com/intellij/webcore/packaging/RepoPackage.java diff --git a/python/openapi/intellij.python.community.iml b/python/openapi/intellij.python.community.iml index e111859d7cc8..a1453c6dd3fb 100644 --- a/python/openapi/intellij.python.community.iml +++ b/python/openapi/intellij.python.community.iml @@ -8,10 +8,12 @@ - - - + + + + + - \ No newline at end of file + diff --git a/python/openapi/src/com/jetbrains/python/module/PyModuleService.java b/python/openapi/src/com/jetbrains/python/module/PyModuleService.java index 62b74f5a7235..9690eeb2d376 100644 --- a/python/openapi/src/com/jetbrains/python/module/PyModuleService.java +++ b/python/openapi/src/com/jetbrains/python/module/PyModuleService.java @@ -15,12 +15,10 @@ */ package com.jetbrains.python.module; -import com.intellij.ide.util.projectWizard.ModuleBuilder; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.platform.DirectoryProjectGenerator; import com.intellij.util.Consumer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,16 +37,6 @@ public abstract class PyModuleService { return ServiceManager.getService(PyModuleService.class); } - /** - * Creates a ModuleBuilder that creates a Python module and runs the specified DirectoryProjectGenerator to perform - * further initialization. The showGenerationSettings() method on the generator is not called, and the generateProject() method - * receives null as the 'settings' parameter. - * - * @param generator the generator to run for configuring the project - * @return the created module builder instance - */ - public abstract ModuleBuilder createPythonModuleBuilder(DirectoryProjectGenerator generator); - public boolean isFileIgnored(@NotNull VirtualFile file) { return false; diff --git a/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java b/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java index 4d4d9b190eb9..28a0a4853cc5 100644 --- a/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java +++ b/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java @@ -1,8 +1,6 @@ // Copyright 2000-2018 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.run; -import com.intellij.execution.RunnerAndConfigurationSettings; -import com.intellij.execution.configurations.ConfigurationFactory; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.module.Module; @@ -22,6 +20,4 @@ public abstract class PyRunConfigurationFactory { * @return the settings of the created run configuration. */ public abstract PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName); - - public abstract RunnerAndConfigurationSettings createRunConfiguration(Module module, ConfigurationFactory factory); } diff --git a/python/python-psi-impl/intellij.python.psi.impl.iml b/python/python-psi-impl/intellij.python.psi.impl.iml index ba2b4f28b40b..8bd12496308d 100644 --- a/python/python-psi-impl/intellij.python.psi.impl.iml +++ b/python/python-psi-impl/intellij.python.psi.impl.iml @@ -17,11 +17,11 @@ - + \ No newline at end of file diff --git a/python/python-psi-impl/test/com/intellij/openapi/application/impl/MockPsiApplication.kt b/python/python-psi-impl/test/com/intellij/openapi/application/impl/MockPsiApplication.kt index 5fcb001db1c6..369859656635 100644 --- a/python/python-psi-impl/test/com/intellij/openapi/application/impl/MockPsiApplication.kt +++ b/python/python-psi-impl/test/com/intellij/openapi/application/impl/MockPsiApplication.kt @@ -6,13 +6,14 @@ import com.intellij.mock.MockFileDocumentManagerImpl import com.intellij.openapi.Disposable import com.intellij.openapi.application.* import com.intellij.openapi.application.ex.ApplicationEx +import com.intellij.openapi.components.ComponentManager import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.impl.DocumentImpl +import com.intellij.openapi.extensions.DefaultPluginDescriptor import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.* import com.intellij.serviceContainer.PlatformComponentManagerImpl -import com.intellij.testFramework.registerServiceInstance import org.jetbrains.ide.PooledThreadExecutor import java.awt.Component import java.util.concurrent.Callable @@ -230,4 +231,8 @@ class MockPsiApplication(parentDisposable: Disposable) : PlatformComponentManage override fun tryRunReadAction(action: Runnable): Boolean { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } -} \ No newline at end of file +} + +fun ComponentManager.registerServiceInstance(serviceInterface: Class, instance: T) { + (this as PlatformComponentManagerImpl).registerServiceInstance(serviceInterface, instance, DefaultPluginDescriptor("test")) +} diff --git a/python/python-psi-impl/test/com/intellij/openapi/project/impl/MockPsiProject.kt b/python/python-psi-impl/test/com/intellij/openapi/project/impl/MockPsiProject.kt index 4f39eb6f2442..f9621456cd64 100644 --- a/python/python-psi-impl/test/com/intellij/openapi/project/impl/MockPsiProject.kt +++ b/python/python-psi-impl/test/com/intellij/openapi/project/impl/MockPsiProject.kt @@ -2,18 +2,13 @@ package com.intellij.openapi.project.impl import com.intellij.ide.plugins.ContainerDescriptor import com.intellij.ide.plugins.IdeaPluginDescriptorImpl -import com.intellij.mock.MockApplication -import com.intellij.mock.MockProject import com.intellij.openapi.Disposable import com.intellij.openapi.application.Application import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.impl.ExtensionsAreaImpl import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer import com.intellij.openapi.vfs.VirtualFile -import com.intellij.serviceContainer.NonInjectable import com.intellij.serviceContainer.PlatformComponentManagerImpl -import com.intellij.testFramework.registerComponentInstance class MockPsiProject(application: Application, parentDisposable: Disposable = application) : PlatformComponentManagerImpl(application), Project { init { @@ -48,4 +43,4 @@ class MockPsiProject(application: Application, parentDisposable: Disposable = ap override fun isInitialized(): Boolean = true override fun isDefault(): Boolean = false -} \ No newline at end of file +} diff --git a/python/python-psi-impl/test/com/jetbrains/python/PythonMockSdk.java b/python/python-psi-impl/test/com/jetbrains/python/PythonMockSdk.java index ab3f85ba54fa..3d4e20c8c73d 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/PythonMockSdk.java +++ b/python/python-psi-impl/test/com/jetbrains/python/PythonMockSdk.java @@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.util.Arrays; +import java.util.Comparator; /** * @author yole @@ -72,43 +73,27 @@ public class PythonMockSdk { return sdk.clone(); } - private static class PyMockSdkType extends SdkType { + private static class PyMockSdkType implements SdkTypeId { @NotNull private final String myVersionString; + private final String mySdkIdName; private PyMockSdkType(@NotNull String string) { - super(PyNames.PYTHON_SDK_ID_NAME); + mySdkIdName = PyNames.PYTHON_SDK_ID_NAME; myVersionString = string; } - @Nullable - @Override - public String suggestHomePath() { - return null; - } - - @Override - public boolean isValidSdkHome(String path) { - return true; - } - @NotNull @Override - public String suggestSdkName(@Nullable String currentSdkName, String sdkHome) { - return "Python"; + public String getName() { + return mySdkIdName; } @Nullable @Override - public AdditionalDataConfigurable createAdditionalDataConfigurable(@NotNull SdkModel sdkModel, @NotNull SdkModificator sdkModificator) { - return null; - } - - @NotNull - @Override - public String getPresentableName() { - return "Python"; + public String getVersionString(@NotNull Sdk sdk) { + return myVersionString; } @Override @@ -118,8 +103,19 @@ public class PythonMockSdk { @Nullable @Override - public String getVersionString(String sdkHome) { - return myVersionString; + public SdkAdditionalData loadAdditionalData(@NotNull Sdk currentSdk, @NotNull Element additional) { + return null; + } + + @Override + public boolean isLocalSdk(@NotNull Sdk sdk) { + return false; + } + + @NotNull + @Override + public Comparator versionComparator() { + return null; } } } diff --git a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiResolveTestCase.kt b/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiResolveTestCase.kt index 030f93d7b8c6..c753e7cca61d 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiResolveTestCase.kt +++ b/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiResolveTestCase.kt @@ -1,16 +1,13 @@ package com.jetbrains.python.fixtures import com.intellij.openapi.util.text.StringUtil -import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.TestLocalVirtualFileSystem import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.psi.PsiManager import com.intellij.psi.PsiReference -import com.intellij.testFramework.TestDataFile import com.jetbrains.python.PythonTestUtil import org.jetbrains.annotations.NonNls -import java.io.File import java.io.IOException @NonNls @@ -20,7 +17,7 @@ open class PyPsiResolveTestCase : PyPsiTestCase() { private val myFileSystem = TestLocalVirtualFileSystem() - protected fun configureByFile(@TestDataFile filePath: String): PsiReference? { + protected fun configureByFile(filePath: String): PsiReference? { val testDataRoot = myFileSystem.refreshAndFindFileByPath(PythonTestUtil.getTestDataPath()) val file = testDataRoot!!.findFileByRelativePath(filePath) @@ -41,4 +38,4 @@ open class PyPsiResolveTestCase : PyPsiTestCase() { val psiFile = PsiManager.getInstance(myProject).findFile(file) return psiFile?.findReferenceAt(offset) } -} \ No newline at end of file +} diff --git a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiTestCase.kt b/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiTestCase.kt index 6c3ec28b271c..2f0e91feb631 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiTestCase.kt +++ b/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyPsiTestCase.kt @@ -1,39 +1,48 @@ package com.jetbrains.python.fixtures import com.intellij.core.CoreFileTypeRegistry -import com.intellij.ide.plugins.IdeaPluginDescriptorImpl import com.intellij.ide.plugins.PluginManagerCore -import com.intellij.idea.IdeaTestApplication -import com.intellij.mock.MockApplication -import com.intellij.mock.MockFileTypeManager -import com.intellij.mock.MockProject import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.impl.MockPsiApplication -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.extensions.impl.ExtensionsAreaImpl -import com.intellij.openapi.fileTypes.FileTypeManager import com.intellij.openapi.fileTypes.FileTypeRegistry import com.intellij.openapi.project.impl.MockPsiProject import com.intellij.openapi.util.Getter import com.intellij.openapi.util.text.StringUtil -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.openapi.vfs.VfsUtilCore -import com.intellij.psi.PsiManager -import com.intellij.psi.PsiReference -import com.intellij.testFramework.PlatformTestUtil -import com.intellij.testFramework.TestDataFile import com.intellij.util.PlatformUtils import com.jetbrains.python.PythonFileType -import com.jetbrains.python.PythonTestUtil.getTestDataPath import junit.framework.TestCase -import org.jetbrains.annotations.NonNls -import java.io.File -import java.io.IOException + +fun getTestName(name: String, lowercaseFirstLetter: Boolean): String { + var name = name + name = StringUtil.trimStart(name, "test") + return if (StringUtil.isEmpty(name)) "" else lowercaseFirstLetter(name, lowercaseFirstLetter) +} + +fun lowercaseFirstLetter(name: String, lowercaseFirstLetter: Boolean): String { + var name = name + if (lowercaseFirstLetter && !isAllUppercaseName(name)) { + name = Character.toLowerCase(name[0]) + name.substring(1) + } + return name +} + +fun isAllUppercaseName(name: String): Boolean { + var uppercaseChars = 0 + for (i in 0 until name.length) { + if (Character.isLowerCase(name[i])) { + return false + } + if (Character.isUpperCase(name[i])) { + uppercaseChars++ + } + } + return uppercaseChars >= 3 +} open class PyPsiTestCase : TestCase() { private val myParentDisposable: Disposable = TestDisposable() - private val myFileTypeManager = MockFileTypeManager(PythonFileType.INSTANCE) + private val myFileTypeManager = CoreFileTypeRegistry() private val myApplication: MockPsiApplication = MockPsiApplication(myParentDisposable) .also { ApplicationManager.setApplication(it, Getter { myFileTypeManager }, myParentDisposable) } protected val myProject: MockPsiProject = MockPsiProject(myApplication) @@ -42,12 +51,13 @@ open class PyPsiTestCase : TestCase() { System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, "PythonPsi") val loadedPlugins = PluginManagerCore.getLoadedPlugins(PyPsiTestCase::class.java.classLoader) myApplication.registerComponents(loadedPlugins) - myApplication.picoContainer.registerComponentInstance(FileTypeManager::class.java, myFileTypeManager) + myApplication.picoContainer.registerComponentInstance(FileTypeRegistry::class.java, myFileTypeManager) myProject.registerComponents(loadedPlugins) + myFileTypeManager.registerFileType(PythonFileType.INSTANCE, "py") } protected fun getTestName(lowercaseFirstLetter: Boolean): String = - name?.let { PlatformTestUtil.getTestName(it, lowercaseFirstLetter) } ?: "" + name?.let { getTestName(it, lowercaseFirstLetter) } ?: "" inner class TestDisposable: Disposable { @Volatile @@ -62,4 +72,4 @@ open class PyPsiTestCase : TestCase() { return this@PyPsiTestCase.javaClass.name + if (StringUtil.isEmpty(testName)) "" else ".test$testName" } } -} \ No newline at end of file +} diff --git a/python/python-psi-impl/test/com/jetbrains/python/lexer/PyStringLiteralLexerTest.java b/python/python-psi-impl/test/com/jetbrains/python/lexer/PyStringLiteralLexerTest.java deleted file mode 100644 index 24c182ec5638..000000000000 --- a/python/python-psi-impl/test/com/jetbrains/python/lexer/PyStringLiteralLexerTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.lexer; - -import com.jetbrains.python.PyTokenTypes; -import com.jetbrains.python.fixtures.PyLexerTestCase; - -/** - * @author yole - */ -public class PyStringLiteralLexerTest extends PyLexerTestCase { - public void testBackslashN() { // PY-1313 - PyLexerTestCase.doLexerTest("u\"\\N{LATIN SMALL LETTER B}\"", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), - "Py:SINGLE_QUOTED_UNICODE", "VALID_STRING_ESCAPE_TOKEN", "Py:SINGLE_QUOTED_UNICODE"); - } - - public void testRawBackslashN() { - PyLexerTestCase.doLexerTest("r'[\\w\\']'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_STRING), true, - "r'[\\w\\']'"); - } - - // PY-20921 - public void testIllegalPrefixes() { - PyLexerTestCase.doLexerTest("ff'foo'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), "Py:SINGLE_QUOTED_UNICODE"); - PyLexerTestCase.doLexerTest("fff'foo'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), "Py:SINGLE_QUOTED_UNICODE"); - PyLexerTestCase.doLexerTest("rrr'''foo'''", new PyStringLiteralLexer(PyTokenTypes.TRIPLE_QUOTED_UNICODE), "Py:TRIPLE_QUOTED_UNICODE"); - } - - // PY-21399 - public void testBackslashBreaksAnyEscapeSequence() { - PyLexerTestCase.doLexerTest("'\\u\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\u", "\\'", ")"); - PyLexerTestCase.doLexerTest("'\\u\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), - "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", - "Py:SINGLE_QUOTED_UNICODE"); - - PyLexerTestCase.doLexerTest("'\\x\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\x", "\\'", ")"); - PyLexerTestCase.doLexerTest("'\\x\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), - "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", - "Py:SINGLE_QUOTED_UNICODE"); - - PyLexerTestCase.doLexerTest("'\\N{F\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\N{F", "\\'", ")"); - PyLexerTestCase.doLexerTest("'\\N{F\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), - "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", - "Py:SINGLE_QUOTED_UNICODE"); - } -} diff --git a/python/python-psi-impl/test/com/jetbrains/python/module/MockPyModuleService.kt b/python/python-psi-impl/test/com/jetbrains/python/module/MockPyModuleService.kt index f87a2b792278..2ceb663bed3e 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/module/MockPyModuleService.kt +++ b/python/python-psi-impl/test/com/jetbrains/python/module/MockPyModuleService.kt @@ -1,16 +1,13 @@ package com.jetbrains.python.module -import com.intellij.ide.util.projectWizard.ModuleBuilder import com.intellij.openapi.module.Module import com.intellij.openapi.projectRoots.Sdk -import com.intellij.platform.DirectoryProjectGenerator import com.jetbrains.python.PythonMockSdk -import com.jetbrains.python.fixtures.PyTestCase -class MockPyModuleService: PyModuleService() { - private val mySdk = PythonMockSdk.create(PyTestCase.PYTHON_3_MOCK_SDK) +val PYTHON_3_MOCK_SDK = "3.7" + +class MockPyModuleService : PyModuleService() { + private val mySdk = PythonMockSdk.create(PYTHON_3_MOCK_SDK) override fun findPythonSdk(module: Module): Sdk? = mySdk - - override fun createPythonModuleBuilder(generator: DirectoryProjectGenerator<*>?): ModuleBuilder = throw UnsupportedOperationException() -} \ No newline at end of file +} diff --git a/python/src/com/jetbrains/python/module/PyModuleServiceEx.java b/python/src/com/jetbrains/python/module/PyModuleServiceEx.java new file mode 100644 index 000000000000..f77f39913aa5 --- /dev/null +++ b/python/src/com/jetbrains/python/module/PyModuleServiceEx.java @@ -0,0 +1,17 @@ +// Copyright 2000-2019 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.module; + +import com.intellij.ide.util.projectWizard.ModuleBuilder; +import com.intellij.platform.DirectoryProjectGenerator; + +public abstract class PyModuleServiceEx extends PyModuleService { + /** + * Creates a ModuleBuilder that creates a Python module and runs the specified DirectoryProjectGenerator to perform + * further initialization. The showGenerationSettings() method on the generator is not called, and the generateProject() method + * receives null as the 'settings' parameter. + * + * @param generator the generator to run for configuring the project + * @return the created module builder instance + */ + public abstract ModuleBuilder createPythonModuleBuilder(DirectoryProjectGenerator generator); +} diff --git a/python/src/com/jetbrains/python/module/PyModuleServiceImpl.java b/python/src/com/jetbrains/python/module/PyModuleServiceImpl.java index 31d5c9669e9d..ddea1af9ebe7 100644 --- a/python/src/com/jetbrains/python/module/PyModuleServiceImpl.java +++ b/python/src/com/jetbrains/python/module/PyModuleServiceImpl.java @@ -34,7 +34,7 @@ import org.jetbrains.annotations.Nullable; /** * @author yole */ -public class PyModuleServiceImpl extends PyModuleService { +public class PyModuleServiceImpl extends PyModuleServiceEx { @Override public ModuleBuilder createPythonModuleBuilder(DirectoryProjectGenerator generator) { return new PythonModuleBuilderBase(generator); diff --git a/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryEx.java b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryEx.java new file mode 100644 index 000000000000..10994fee776d --- /dev/null +++ b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryEx.java @@ -0,0 +1,10 @@ +// Copyright 2000-2019 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.run; + +import com.intellij.execution.RunnerAndConfigurationSettings; +import com.intellij.execution.configurations.ConfigurationFactory; +import com.intellij.openapi.module.Module; + +public abstract class PyRunConfigurationFactoryEx extends PyRunConfigurationFactory { + public abstract RunnerAndConfigurationSettings createRunConfiguration(Module module, ConfigurationFactory factory); +} diff --git a/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java index f5afd50fdd3b..0460df68c8b9 100644 --- a/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java +++ b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java @@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; /** * @author yole */ -public class PyRunConfigurationFactoryImpl extends PyRunConfigurationFactory { +public class PyRunConfigurationFactoryImpl extends PyRunConfigurationFactoryEx { @Override public PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName) { RunnerAndConfigurationSettings settings = createRunConfiguration(module, PythonConfigurationType.getInstance().getFactory()); diff --git a/python/testSrc/com/jetbrains/python/PyStringLiteralLexerTest.java b/python/testSrc/com/jetbrains/python/PyStringLiteralLexerTest.java new file mode 100644 index 000000000000..28625d01b832 --- /dev/null +++ b/python/testSrc/com/jetbrains/python/PyStringLiteralLexerTest.java @@ -0,0 +1,46 @@ +// Copyright 2000-2019 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.PyTokenTypes; +import com.jetbrains.python.fixtures.PyLexerTestCase; +import com.jetbrains.python.lexer.PyStringLiteralLexer; + +/** + * @author yole + */ +public class PyStringLiteralLexerTest extends PyLexerTestCase { + public void testBackslashN() { // PY-1313 + PyLexerTestCase.doLexerTest("u\"\\N{LATIN SMALL LETTER B}\"", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), + "Py:SINGLE_QUOTED_UNICODE", "VALID_STRING_ESCAPE_TOKEN", "Py:SINGLE_QUOTED_UNICODE"); + } + + public void testRawBackslashN() { + doLexerTest("r'[\\w\\']'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_STRING), true, + "r'[\\w\\']'"); + } + + // PY-20921 + public void testIllegalPrefixes() { + doLexerTest("ff'foo'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), "Py:SINGLE_QUOTED_UNICODE"); + doLexerTest("fff'foo'", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), "Py:SINGLE_QUOTED_UNICODE"); + doLexerTest("rrr'''foo'''", new PyStringLiteralLexer(PyTokenTypes.TRIPLE_QUOTED_UNICODE), "Py:TRIPLE_QUOTED_UNICODE"); + } + + // PY-21399 + public void testBackslashBreaksAnyEscapeSequence() { + doLexerTest("'\\u\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\u", "\\'", ")"); + doLexerTest("'\\u\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), + "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", + "Py:SINGLE_QUOTED_UNICODE"); + + doLexerTest("'\\x\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\x", "\\'", ")"); + doLexerTest("'\\x\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), + "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", + "Py:SINGLE_QUOTED_UNICODE"); + + doLexerTest("'\\N{F\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), true, "'", "\\N{F", "\\'", ")"); + doLexerTest("'\\N{F\\')", new PyStringLiteralLexer(PyTokenTypes.SINGLE_QUOTED_UNICODE), + "Py:SINGLE_QUOTED_UNICODE", "INVALID_UNICODE_ESCAPE_TOKEN", "VALID_STRING_ESCAPE_TOKEN", + "Py:SINGLE_QUOTED_UNICODE"); + } +} diff --git a/python/python-psi-impl/test/com/jetbrains/python/completion/PythonCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java similarity index 99% rename from python/python-psi-impl/test/com/jetbrains/python/completion/PythonCompletionTest.java rename to python/testSrc/com/jetbrains/python/PythonCompletionTest.java index 72c49385cb93..fdf4e612702a 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/completion/PythonCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java @@ -1,5 +1,5 @@ -// 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.completion; +// Copyright 2000-2019 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.google.common.collect.Lists; import com.intellij.codeInsight.completion.CompletionType; diff --git a/python/python-psi-impl/test/com/jetbrains/python/lexer/PythonLexerTest.java b/python/testSrc/com/jetbrains/python/PythonLexerTest.java similarity index 97% rename from python/python-psi-impl/test/com/jetbrains/python/lexer/PythonLexerTest.java rename to python/testSrc/com/jetbrains/python/PythonLexerTest.java index d765e80e1282..78cd8e9a701c 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/lexer/PythonLexerTest.java +++ b/python/testSrc/com/jetbrains/python/PythonLexerTest.java @@ -1,21 +1,8 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.lexer; +// Copyright 2000-2019 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.fixtures.PyLexerTestCase; +import com.jetbrains.python.lexer.PythonIndentingLexer; /** * @author yole diff --git a/python/python-psi-impl/test/com/jetbrains/python/parsing/PyStringFormatParserTest.java b/python/testSrc/com/jetbrains/python/breadcrumbs/PyStringFormatParserTest.java similarity index 85% rename from python/python-psi-impl/test/com/jetbrains/python/parsing/PyStringFormatParserTest.java rename to python/testSrc/com/jetbrains/python/breadcrumbs/PyStringFormatParserTest.java index f810b817532f..2d3ca4b0533e 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/parsing/PyStringFormatParserTest.java +++ b/python/testSrc/com/jetbrains/python/breadcrumbs/PyStringFormatParserTest.java @@ -1,19 +1,5 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.parsing; +// Copyright 2000-2019 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.breadcrumbs; import com.intellij.openapi.util.TextRange; import com.intellij.testFramework.UsefulTestCase; @@ -261,8 +247,8 @@ public class PyStringFormatParserTest extends TestCase { final List topLevelFields = result.getFields(); UsefulTestCase.assertSize(2, topLevelFields); UsefulTestCase.assertSize(5, result.getAllFields()); - UsefulTestCase.assertOrderedEquals(result.getAllFields().stream().map(Field::getDepth).toArray(), 1, 2, 3, 4, 1); - UsefulTestCase.assertOrderedEquals(result.getAllFields().stream().map(SubstitutionChunk::getAutoPosition).toArray(), 0, 1, 2, 3, 4); + assertOrderedEquals(result.getAllFields().stream().map(Field::getDepth).toArray(), 1, 2, 3, 4, 1); + assertOrderedEquals(result.getAllFields().stream().map(SubstitutionChunk::getAutoPosition).toArray(), 0, 1, 2, 3, 4); } public void testNewStyleAttrAndLookups() { @@ -278,40 +264,40 @@ public class PyStringFormatParserTest extends TestCase { field = doParseAndGetFirstField("u'{foo.bar.baz}'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".bar", ".baz"); + assertOrderedEquals(field.getAttributesAndLookups(), ".bar", ".baz"); field = doParseAndGetFirstField("u'{foo[bar][baz]}'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[bar]", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[bar]", "[baz]"); field = doParseAndGetFirstField("u'{foo.bar[baz]}'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), ".bar", "[baz]"); field = doParseAndGetFirstField("u'{foo.bar[baz}'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), ".bar"); field = doParseAndGetFirstField("u'{foo[{bar[baz]}'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[{bar[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[{bar[baz]"); field = doParseAndGetFirstField("u'{foo[{} {0} {bar.baz}]'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[{} {0} {bar.baz}]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[{} {0} {bar.baz}]"); field = doParseAndGetFirstField("u'{foo[bar]baz'"); TestCase.assertEquals("foo", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[bar]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[bar]"); field = doParseAndGetFirstField("'{0[foo][.!:][}]}'"); TestCase.assertEquals("0", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "[.!:]", "[}]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "[.!:]", "[}]"); field = doParseAndGetFirstField("'{.foo.bar}'"); UsefulTestCase.assertEmpty(field.getFirstName()); TestCase.assertEquals(TextRange.create(2, 2), field.getFirstNameRange()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".foo", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), ".foo", ".bar"); field = doParseAndGetFirstField("'{}'"); UsefulTestCase.assertEmpty(field.getFirstName()); @@ -344,68 +330,68 @@ public class PyStringFormatParserTest extends TestCase { UsefulTestCase.assertEmpty(field.getAttributesAndLookups()); field = doParseAndGetFirstField("'{0[foo].bar[baz]}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); // do not recover unfinished lookups field = doParseAndGetFirstField("'{0[foo].bar[ba}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar[ba!}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar[ba:}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar[ba'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar[ba"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); // do not recover illegal attributes field = doParseAndGetFirstField("'{0[foo].bar[baz]quux}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]quux!}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]quux:}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]quux'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0[foo].bar[baz]quux"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar", "[baz]"); field = doParseAndGetFirstField("'{0..}'"); TestCase.assertEquals("0", field.getFirstName()); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".", "."); + assertOrderedEquals(field.getAttributesAndLookups(), ".", "."); // recover attributes field = doParseAndGetFirstField("'{0[foo].}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); field = doParseAndGetFirstField("'{0[foo].'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); field = doParseAndGetFirstField("'{0[foo]."); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", "."); field = doParseAndGetFirstField("'{0[foo].bar}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); field = doParseAndGetFirstField("'{0[foo].bar"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); + assertOrderedEquals(field.getAttributesAndLookups(), "[foo]", ".bar"); } public void testNewStyleAutoPosition() { @@ -444,12 +430,12 @@ public class PyStringFormatParserTest extends TestCase { public void testNewStyleNamedUnicodeEscapeInLookup() { final Field field = doParseAndGetFirstField("'{foo[\\N{ESCAPE WITH ]}]}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), "[\\N{ESCAPE WITH ]}]"); + assertOrderedEquals(field.getAttributesAndLookups(), "[\\N{ESCAPE WITH ]}]"); } public void testNewStyleNamedUnicodeEscapeInAttribute() { final Field field = doParseAndGetFirstField("'{foo.b\\N{ESCAPE WITH [}.b\\N{ESCAPE WITH .}}'"); - UsefulTestCase.assertOrderedEquals(field.getAttributesAndLookups(), ".b\\N{ESCAPE WITH [}", ".b\\N{ESCAPE WITH .}"); + assertOrderedEquals(field.getAttributesAndLookups(), ".b\\N{ESCAPE WITH [}", ".b\\N{ESCAPE WITH .}"); } public void testNewStyleUnclosedLookupEndsWithRightBrace() { diff --git a/python/python-psi-impl/test/com/jetbrains/python/parsing/PythonParsingTest.java b/python/testSrc/com/jetbrains/python/breadcrumbs/PythonParsingTest.java similarity index 97% rename from python/python-psi-impl/test/com/jetbrains/python/parsing/PythonParsingTest.java rename to python/testSrc/com/jetbrains/python/breadcrumbs/PythonParsingTest.java index 0bc509d41e86..b0a5757f5f9a 100644 --- a/python/python-psi-impl/test/com/jetbrains/python/parsing/PythonParsingTest.java +++ b/python/testSrc/com/jetbrains/python/breadcrumbs/PythonParsingTest.java @@ -1,19 +1,5 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.parsing; +// Copyright 2000-2019 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.breadcrumbs; import com.intellij.lang.LanguageASTFactory; import com.intellij.psi.PsiFile; diff --git a/python/testSrc/com/jetbrains/python/console/PythonInConsoleParsingTest.kt b/python/testSrc/com/jetbrains/python/console/PythonInConsoleParsingTest.kt index 94e630bdbffd..086ffcc5d7e6 100644 --- a/python/testSrc/com/jetbrains/python/console/PythonInConsoleParsingTest.kt +++ b/python/testSrc/com/jetbrains/python/console/PythonInConsoleParsingTest.kt @@ -3,7 +3,7 @@ package com.jetbrains.python.console import com.intellij.openapi.project.Project import com.jetbrains.python.PythonParserDefinition -import com.jetbrains.python.parsing.PythonParsingTest +import com.jetbrains.python.breadcrumbs.PythonParsingTest import com.jetbrains.python.parsing.console.PyConsoleParser import com.jetbrains.python.parsing.console.PythonConsoleData import com.jetbrains.python.parsing.console.PythonConsoleLexer diff --git a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyLexerTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/PyLexerTestCase.java similarity index 100% rename from python/python-psi-impl/test/com/jetbrains/python/fixtures/PyLexerTestCase.java rename to python/testSrc/com/jetbrains/python/fixtures/PyLexerTestCase.java diff --git a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java b/python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java similarity index 100% rename from python/python-psi-impl/test/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java rename to python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java diff --git a/python/python-psi-impl/test/com/jetbrains/python/fixtures/PyTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java similarity index 100% rename from python/python-psi-impl/test/com/jetbrains/python/fixtures/PyTestCase.java rename to python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java