mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Python tests: store a path to conda in PyCondaPackageService.
While one should use a conda path from `PyCondaFlavorData`, some legacy code still depends on this service. This service does a good job trying to find conda on a user PC, but obviously fails in test as conda is installed in a usual location. We store a conda path in this service to make tests work GitOrigin-RevId: d8e1d08b268ae5259e7050c5c9bb8cc8184e3751
This commit is contained in:
committed by
intellij-monorepo-bot
parent
309b296936
commit
bc09d9cd01
+4
@@ -6,6 +6,7 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.python.community.testFramework.testEnv.PythonType
|
||||
import com.jetbrains.python.PythonBinary
|
||||
import com.jetbrains.python.packaging.PyCondaPackageService
|
||||
import com.jetbrains.python.packaging.findCondaExecutableRelativeToEnv
|
||||
import com.jetbrains.python.sdk.conda.TargetEnvironmentRequestCommandExecutor
|
||||
import com.jetbrains.python.sdk.flavors.conda.PyCondaEnv
|
||||
@@ -14,6 +15,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.pathString
|
||||
|
||||
@Internal
|
||||
data object TypeConda : PythonType<PyCondaEnv>("conda") {
|
||||
@@ -23,6 +25,8 @@ data object TypeConda : PythonType<PyCondaEnv>("conda") {
|
||||
override suspend fun pythonPathToEnvironment(pythonBinary: PythonBinary, envDir: Path): Pair<PyCondaEnv, AutoCloseable> {
|
||||
// First, find python binary, then calculate conda from it as env stores "conda" as a regular env
|
||||
val condaPath = findCondaExecutableRelativeToEnv(pythonBinary) ?: error("Conda root $pythonBinary doesn't have conda binary")
|
||||
// Save a path to conda because some legacy code might use it instead of a full conda path from additional data
|
||||
PyCondaPackageService.onCondaEnvCreated(condaPath.pathString)
|
||||
|
||||
// We'll remove then on close
|
||||
val condaEnvsBeforeTest = getCondaNames(condaPath)
|
||||
|
||||
Reference in New Issue
Block a user