From 88dc070d161953340d32c03503b9dcd0276de9cf Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Sun, 2 Feb 2025 04:13:56 +0100 Subject: [PATCH] Python: move classes to access pythons created by setup-env script into right module. We now store classes to access pythons installed by tests setup env right next to the script GitOrigin-RevId: 922e5cfbb89e1e550679796e02deb24553ad6852 --- .idea/modules.xml | 1 + python/intellij.python.community.tests.iml | 1 + ...python.community.junit5Tests.framework.iml | 3 ++- .../env/impl/CondaPythonEnvExtension.kt | 3 ++- .../env/impl/PythonEnvExtensionBase.kt | 4 ++-- .../env/impl/VanillaPythonEnvExtension.kt | 2 +- .../junit5Tests/framework/env/sdkFixture.kt | 6 +++--- .../intellij.python.terminal.iml | 1 + ...python.community.services.systemPython.iml | 1 + .../impl/EnvTestPythonProvider.kt | 2 +- python/setup-test-environment/README.txt | 3 +++ ...python.community.testFramework.testEnv.iml | 19 +++++++++++++++++++ .../testEnv}/PyEnvTestSettings.kt | 8 +++----- .../testFramework/testEnv}/PythonType.kt | 10 +++++----- .../testFramework/testEnv}/envTags.kt | 4 ++-- .../testFramework/testEnv/package-info.java | 8 ++++++++ ...ntellij.python.community.testFramework.iml | 1 + .../src/com/jetbrains/python/tools/sdk.kt | 3 ++- .../com/jetbrains/env/PyEnvTaskRunner.java | 8 ++++---- .../com/jetbrains/env/PyEnvTestCase.java | 12 ++++-------- .../env/python/PyEnvSufficiencyTest.java | 6 +++--- .../com/jetbrains/env/python/PySDKRule.kt | 8 ++++---- .../env/python/conda/LocalCondaRule.kt | 4 ++-- 23 files changed, 75 insertions(+), 43 deletions(-) create mode 100644 python/setup-test-environment/README.txt create mode 100644 python/setup-test-environment/intellij.python.community.testFramework.testEnv.iml rename python/{testFramework/src/com/jetbrains/python/tools => setup-test-environment/src/com/intellij/python/community/testFramework/testEnv}/PyEnvTestSettings.kt (94%) rename python/{testFramework/src/com/jetbrains/python/tools => setup-test-environment/src/com/intellij/python/community/testFramework/testEnv}/PythonType.kt (95%) rename python/{testFramework/src/com/jetbrains/python/tools => setup-test-environment/src/com/intellij/python/community/testFramework/testEnv}/envTags.kt (87%) create mode 100644 python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/package-info.java diff --git a/.idea/modules.xml b/.idea/modules.xml index 1d302dd1da51..27ad19ae9e8f 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -943,6 +943,7 @@ + diff --git a/python/intellij.python.community.tests.iml b/python/intellij.python.community.tests.iml index dd5b1c7e2dc9..023e70a4ffdb 100644 --- a/python/intellij.python.community.tests.iml +++ b/python/intellij.python.community.tests.iml @@ -69,5 +69,6 @@ + \ No newline at end of file diff --git a/python/junit5Tests-framework/intellij.python.community.junit5Tests.framework.iml b/python/junit5Tests-framework/intellij.python.community.junit5Tests.framework.iml index b658b3b0829a..ad613e02289f 100644 --- a/python/junit5Tests-framework/intellij.python.community.junit5Tests.framework.iml +++ b/python/junit5Tests-framework/intellij.python.community.junit5Tests.framework.iml @@ -9,7 +9,6 @@ - @@ -32,5 +31,7 @@ + + \ No newline at end of file diff --git a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/CondaPythonEnvExtension.kt b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/CondaPythonEnvExtension.kt index e6d35837c780..8666f5beec12 100644 --- a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/CondaPythonEnvExtension.kt +++ b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/CondaPythonEnvExtension.kt @@ -1,8 +1,9 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.python.junit5Tests.framework.env.impl +import com.intellij.python.community.testFramework.testEnv.PythonType import com.intellij.python.junit5Tests.framework.env.CondaEnv import com.jetbrains.python.sdk.flavors.conda.PyCondaEnv -import com.jetbrains.python.tools.PythonType /** * Mark [PyCondaEnv] param with [CondaEnv] annotation and register this extension with [com.intellij.python.junit5Tests.framework.env.PyEnvTestCaseWithConda] diff --git a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/PythonEnvExtensionBase.kt b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/PythonEnvExtensionBase.kt index a765440cf4c8..ba07f4a277b1 100644 --- a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/PythonEnvExtensionBase.kt +++ b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/PythonEnvExtensionBase.kt @@ -1,8 +1,8 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.python.junit5Tests.framework.env.impl import com.intellij.openapi.diagnostic.Logger -import com.jetbrains.python.tools.PythonType +import com.intellij.python.community.testFramework.testEnv.PythonType import kotlinx.coroutines.runBlocking import org.jetbrains.annotations.NonNls import org.junit.jupiter.api.extension.BeforeAllCallback diff --git a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/VanillaPythonEnvExtension.kt b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/VanillaPythonEnvExtension.kt index 788b6b50ddfc..9a42fe095728 100644 --- a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/VanillaPythonEnvExtension.kt +++ b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/impl/VanillaPythonEnvExtension.kt @@ -6,9 +6,9 @@ import com.intellij.execution.process.CapturingProcessHandler import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.util.SystemInfoRt import com.intellij.python.community.impl.poetry.poetryPath +import com.intellij.python.community.testFramework.testEnv.PythonType import com.intellij.python.junit5Tests.framework.env.PythonBinaryPath import com.jetbrains.python.PythonBinary -import com.jetbrains.python.tools.PythonType import java.nio.file.Path /** diff --git a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/sdkFixture.kt b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/sdkFixture.kt index eb40ea849a4c..8b84eddadc33 100644 --- a/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/sdkFixture.kt +++ b/python/junit5Tests-framework/src/com/intellij/python/junit5Tests/framework/env/sdkFixture.kt @@ -1,3 +1,4 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.python.junit5Tests.framework.env import com.intellij.openapi.application.EDT @@ -6,14 +7,13 @@ import com.intellij.openapi.application.writeIntentReadAction import com.intellij.openapi.module.Module import com.intellij.openapi.projectRoots.ProjectJdkTable import com.intellij.openapi.projectRoots.Sdk +import com.intellij.python.community.testFramework.testEnv.PythonType import com.intellij.testFramework.junit5.fixture.TestFixture import com.intellij.testFramework.junit5.fixture.testFixture import com.jetbrains.python.sdk.configuration.createVirtualEnvSynchronously import com.jetbrains.python.sdk.persist import com.jetbrains.python.sdk.pythonSdk -import com.jetbrains.python.tools.PythonType import com.jetbrains.python.tools.SdkCreationRequest.LocalPython -import com.jetbrains.python.tools.createSdk import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import java.nio.file.Path @@ -27,7 +27,7 @@ typealias PySdkFixture = TestFixture fun pySdkFixture( pythonType: PythonType<*> = PythonType.VanillaPython3, ): PySdkFixture = testFixture { - val (sdk, autoClosable) = createSdk(LocalPython(pythonType)) + val (sdk, autoClosable) = com.jetbrains.python.tools.createSdk(LocalPython(pythonType)) sdk.persist() initialized(sdk) { writeAction { diff --git a/python/python-terminal/intellij.python.terminal.iml b/python/python-terminal/intellij.python.terminal.iml index aa8349cc7227..61da60a050e8 100644 --- a/python/python-terminal/intellij.python.terminal.iml +++ b/python/python-terminal/intellij.python.terminal.iml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/python/services/system-python/intellij.python.community.services.systemPython.iml b/python/services/system-python/intellij.python.community.services.systemPython.iml index 80a4c19b4185..a97ce3ee2739 100644 --- a/python/services/system-python/intellij.python.community.services.systemPython.iml +++ b/python/services/system-python/intellij.python.community.services.systemPython.iml @@ -30,5 +30,6 @@ + \ No newline at end of file diff --git a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvTestPythonProvider.kt b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvTestPythonProvider.kt index f1bb8b44dfe5..dd3043083c86 100644 --- a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvTestPythonProvider.kt +++ b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvTestPythonProvider.kt @@ -5,9 +5,9 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.util.Disposer import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.provider.localEel +import com.intellij.python.community.testFramework.testEnv.PythonType import com.jetbrains.python.PythonBinary import com.jetbrains.python.systemPythonSpi.SystemPythonProvider -import com.jetbrains.python.tools.PythonType import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toSet diff --git a/python/setup-test-environment/README.txt b/python/setup-test-environment/README.txt new file mode 100644 index 000000000000..ec8912064b5b --- /dev/null +++ b/python/setup-test-environment/README.txt @@ -0,0 +1,3 @@ +Python tests require pythons with certain modules. + +Run `build.gradle.kts` to install them. Then, use classes from this module to access them. \ No newline at end of file diff --git a/python/setup-test-environment/intellij.python.community.testFramework.testEnv.iml b/python/setup-test-environment/intellij.python.community.testFramework.testEnv.iml new file mode 100644 index 000000000000..1d54991f73f5 --- /dev/null +++ b/python/setup-test-environment/intellij.python.community.testFramework.testEnv.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/python/testFramework/src/com/jetbrains/python/tools/PyEnvTestSettings.kt b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PyEnvTestSettings.kt similarity index 94% rename from python/testFramework/src/com/jetbrains/python/tools/PyEnvTestSettings.kt rename to python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PyEnvTestSettings.kt index 9b11e33e4a0f..596837906f5e 100644 --- a/python/testFramework/src/com/jetbrains/python/tools/PyEnvTestSettings.kt +++ b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PyEnvTestSettings.kt @@ -1,16 +1,14 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.tools +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.python.community.testFramework.testEnv +import com.intellij.python.community.testFramework.testEnv.PyEnvTestSettings.Companion.PATH_TO_TEST_ENV_PYTHON_INTERPRETERS import com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY import com.intellij.util.SystemProperties -import com.jetbrains.python.tools.PyEnvTestSettings.Companion.PATH_TO_TEST_ENV_PYTHON_INTERPRETERS import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.TestOnly import java.io.File -//TODO: Use Konfig instead? - /** * Configures env test environment using env vars and properties. * Environment variables are also used in gradle script (setup-test-environment) diff --git a/python/testFramework/src/com/jetbrains/python/tools/PythonType.kt b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PythonType.kt similarity index 95% rename from python/testFramework/src/com/jetbrains/python/tools/PythonType.kt rename to python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PythonType.kt index d76eb382b290..34d711fc7674 100644 --- a/python/testFramework/src/com/jetbrains/python/tools/PythonType.kt +++ b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/PythonType.kt @@ -1,5 +1,5 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.tools +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.python.community.testFramework.testEnv import com.intellij.execution.processTools.getResultStdout import com.intellij.execution.target.local.LocalTargetEnvironmentRequest @@ -8,19 +8,19 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.util.concurrency.annotations.RequiresBackgroundThread import com.jetbrains.python.PythonBinary -import com.jetbrains.python.failure import com.jetbrains.python.packaging.findCondaExecutableRelativeToEnv -import com.jetbrains.python.venvReader.VirtualEnvReader import com.jetbrains.python.sdk.conda.TargetEnvironmentRequestCommandExecutor import com.jetbrains.python.sdk.flavors.PythonSdkFlavor import com.jetbrains.python.sdk.flavors.conda.PyCondaEnv import com.jetbrains.python.sdk.flavors.conda.PyCondaEnvIdentity +import com.jetbrains.python.venvReader.VirtualEnvReader import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.* import kotlinx.coroutines.runBlocking import org.jetbrains.annotations.NonNls import java.nio.file.Path import java.util.concurrent.ConcurrentHashMap +import kotlin.Result.Companion.failure /** * Gradle script installs two types of python: conda and vanilla. Env could be obtained by [getTestEnvironment] which also provides closable @@ -69,7 +69,7 @@ sealed class PythonType(private val tag: @NonNls String? = null) { */ suspend fun getTestEnvironment(vararg additionalTags: @NonNls String): Result> = getTestEnvironments(*additionalTags).firstOrNull()?.let { Result.success(it) } - ?: failure("No python found. See ${PyEnvTestSettings::class} class for more info") + ?: failure(AssertionError("No python found. See ${PyEnvTestSettings::class} class for more info")) protected abstract suspend fun pythonPathToEnvironment(pythonBinary: PythonBinary, envDir: Path): Pair diff --git a/python/testFramework/src/com/jetbrains/python/tools/envTags.kt b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/envTags.kt similarity index 87% rename from python/testFramework/src/com/jetbrains/python/tools/envTags.kt rename to python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/envTags.kt index b2054495d665..3de5c9e78158 100644 --- a/python/testFramework/src/com/jetbrains/python/tools/envTags.kt +++ b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/envTags.kt @@ -1,5 +1,5 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.tools +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.python.community.testFramework.testEnv import com.intellij.openapi.diagnostic.fileLogger import com.jetbrains.python.venvReader.Directory diff --git a/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/package-info.java b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/package-info.java new file mode 100644 index 000000000000..2705b2e28225 --- /dev/null +++ b/python/setup-test-environment/src/com/intellij/python/community/testFramework/testEnv/package-info.java @@ -0,0 +1,8 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +/** + * Package to access pythons created by community/python/setup-test-environment/build.gradle.kts + */ +@ApiStatus.Internal +package com.intellij.python.community.testFramework.testEnv; + +import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/python/testFramework/intellij.python.community.testFramework.iml b/python/testFramework/intellij.python.community.testFramework.iml index 9f140677de93..59bde13dd5d8 100644 --- a/python/testFramework/intellij.python.community.testFramework.iml +++ b/python/testFramework/intellij.python.community.testFramework.iml @@ -12,5 +12,6 @@ + \ No newline at end of file diff --git a/python/testFramework/src/com/jetbrains/python/tools/sdk.kt b/python/testFramework/src/com/jetbrains/python/tools/sdk.kt index 37d9946a7f33..792bad30926a 100644 --- a/python/testFramework/src/com/jetbrains/python/tools/sdk.kt +++ b/python/testFramework/src/com/jetbrains/python/tools/sdk.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.python.tools import com.intellij.execution.target.FullPathOnTarget @@ -7,6 +7,7 @@ import com.intellij.openapi.application.writeAction import com.intellij.openapi.projectRoots.ProjectJdkTable import com.intellij.openapi.projectRoots.Sdk import com.intellij.openapi.projectRoots.impl.SdkConfigurationUtil +import com.intellij.python.community.testFramework.testEnv.PythonType import com.intellij.remote.RemoteSdkException import com.intellij.testFramework.utils.vfs.refreshAndGetVirtualFile import com.jetbrains.python.sdk.PythonSdkType diff --git a/python/testSrc/com/jetbrains/env/PyEnvTaskRunner.java b/python/testSrc/com/jetbrains/env/PyEnvTaskRunner.java index 42a5ea6fc20c..93a69b8e4b39 100644 --- a/python/testSrc/com/jetbrains/env/PyEnvTaskRunner.java +++ b/python/testSrc/com/jetbrains/env/PyEnvTaskRunner.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.env; import com.google.common.collect.Sets; @@ -8,15 +8,16 @@ import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.python.community.testFramework.testEnv.EnvTagsKt; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import com.jetbrains.LoggingRule; import com.jetbrains.python.psi.LanguageLevel; import com.jetbrains.python.sdk.PySdkUtil; -import com.jetbrains.python.venvReader.VirtualEnvReader; import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; import com.jetbrains.python.tools.sdkTools.PySdkTools; import com.jetbrains.python.tools.sdkTools.SdkCreationType; +import com.jetbrains.python.venvReader.VirtualEnvReader; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,7 +25,6 @@ import java.io.File; import java.nio.file.Path; import java.util.*; -import static com.jetbrains.python.tools.EnvTagsKt.loadEnvTags; public class PyEnvTaskRunner { private static final Logger LOG = Logger.getInstance(PyEnvTaskRunner.class); @@ -178,7 +178,7 @@ public class PyEnvTaskRunner { EnvInfo(@NotNull String root) { this.root = root; - tags = loadEnvTags(Path.of(root)).stream().toList(); + tags = EnvTagsKt.loadEnvTags(Path.of(root)).stream().toList(); pythonVersion = ContainerUtil.find(tags, tag -> tag.matches("^python\\d\\.\\d+$")); } diff --git a/python/testSrc/com/jetbrains/env/PyEnvTestCase.java b/python/testSrc/com/jetbrains/env/PyEnvTestCase.java index eee220de92ec..e2995a4a52cc 100644 --- a/python/testSrc/com/jetbrains/env/PyEnvTestCase.java +++ b/python/testSrc/com/jetbrains/env/PyEnvTestCase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.env; import com.intellij.openapi.Disposable; @@ -6,13 +6,14 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; +import com.intellij.python.community.testFramework.testEnv.EnvTagsKt; +import com.intellij.python.community.testFramework.testEnv.PyEnvTestSettings; import com.intellij.testFramework.UsefulTestCase; import com.intellij.util.ArrayUtil; import com.intellij.util.ArrayUtilRt; import com.intellij.util.containers.ContainerUtil; import com.jetbrains.LoggingRule; import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; -import com.jetbrains.python.tools.PyEnvTestSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.*; @@ -25,7 +26,6 @@ import java.nio.file.Path; import java.util.*; import static com.intellij.testFramework.assertions.Assertions.assertThat; -import static com.jetbrains.python.tools.EnvTagsKt.loadEnvTags; /** *

@@ -123,14 +123,10 @@ public abstract class PyEnvTestCase { @BeforeClass public static void collectTagsForEnvs() { for (final String pythonRoot : getDefaultPythonRoots()) { - envTags.put(pythonRoot, loadEnvTags(Path.of(pythonRoot)).stream().toList()); + envTags.put(pythonRoot, EnvTagsKt.loadEnvTags(Path.of(pythonRoot)).stream().toList()); } } - protected boolean runInDispatchThread() { - return false; - } - /** * Runs task on several envs. If you care about exception thrown from task use {@link #runPythonTestWithException(PyTestTask)} */ diff --git a/python/testSrc/com/jetbrains/env/python/PyEnvSufficiencyTest.java b/python/testSrc/com/jetbrains/env/python/PyEnvSufficiencyTest.java index f7229b6774c0..962cdaaf69e6 100644 --- a/python/testSrc/com/jetbrains/env/python/PyEnvSufficiencyTest.java +++ b/python/testSrc/com/jetbrains/env/python/PyEnvSufficiencyTest.java @@ -1,9 +1,10 @@ -// Copyright 2000-2020 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. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.env.python; import com.google.common.collect.ImmutableList; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.python.community.testFramework.testEnv.EnvTagsKt; import com.intellij.testFramework.UsefulTestCase; import com.jetbrains.env.PyEnvTestCase; import org.junit.Test; @@ -12,7 +13,6 @@ import java.nio.file.Path; import java.util.*; import static com.intellij.testFramework.UsefulTestCase.assertEmpty; -import static com.jetbrains.python.tools.EnvTagsKt.loadEnvTags; public class PyEnvSufficiencyTest extends PyEnvTestCase { private static final List BASE_TAGS = @@ -28,7 +28,7 @@ public class PyEnvSufficiencyTest extends PyEnvTestCase { return; // not on env agent } for (String root : roots) { - tags.addAll(loadEnvTags(Path.of(root))); + tags.addAll(EnvTagsKt.loadEnvTags(Path.of(root))); } List missing = new ArrayList<>(); diff --git a/python/testSrc/com/jetbrains/env/python/PySDKRule.kt b/python/testSrc/com/jetbrains/env/python/PySDKRule.kt index 14eccfd98845..abb9589a357a 100644 --- a/python/testSrc/com/jetbrains/env/python/PySDKRule.kt +++ b/python/testSrc/com/jetbrains/env/python/PySDKRule.kt @@ -1,10 +1,10 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.env.python import com.intellij.execution.target.TargetEnvironmentConfiguration import com.intellij.openapi.projectRoots.Sdk -import com.jetbrains.python.tools.PyEnvTestSettings -import com.jetbrains.python.tools.SdkCreationRequest.* +import com.jetbrains.python.tools.SdkCreationRequest.LocalPython +import com.jetbrains.python.tools.SdkCreationRequest.RemotePython import com.jetbrains.python.tools.createSdk import kotlinx.coroutines.runBlocking import org.junit.rules.ExternalResource @@ -13,7 +13,7 @@ import org.junit.rules.ExternalResource /** * Creates python SDK either local (if [targetConfigProducer] is null) or target. * In case of target, it should have [com.jetbrains.python.tools.PYTHON_PATH_ON_TARGET] - * Locals are search automatically like in [PyEnvTestSettings] or using [com.jetbrains.python.sdk.flavors.PythonSdkFlavor.suggestLocalHomePaths] + * Locals are search automatically like in [com.intellij.python.community.testFramework.testEnv.PyEnvTestSettings] or using [com.jetbrains.python.sdk.flavors.PythonSdkFlavor.suggestLocalHomePaths] */ class PySDKRule(private val targetConfigProducer: (() -> TargetEnvironmentConfiguration)?) : ExternalResource() { diff --git a/python/testSrc/com/jetbrains/env/python/conda/LocalCondaRule.kt b/python/testSrc/com/jetbrains/env/python/conda/LocalCondaRule.kt index efd1f4641b65..14137f58da9a 100644 --- a/python/testSrc/com/jetbrains/env/python/conda/LocalCondaRule.kt +++ b/python/testSrc/com/jetbrains/env/python/conda/LocalCondaRule.kt @@ -1,9 +1,9 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.env.python.conda import com.intellij.execution.target.FullPathOnTarget import com.intellij.execution.target.local.LocalTargetEnvironmentRequest -import com.jetbrains.python.tools.PythonType +import com.intellij.python.community.testFramework.testEnv.PythonType import com.jetbrains.python.sdk.conda.TargetCommandExecutor import com.jetbrains.python.sdk.conda.TargetEnvironmentRequestCommandExecutor import com.jetbrains.python.sdk.flavors.conda.PyCondaCommand