mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Python tests: timeout increased (venv might be slow on some agents)
GitOrigin-RevId: 49cb95c758ce51743e8e1c4c67b79f20b19ceef4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
df4d3b4c88
commit
baf30ce79a
@@ -43,5 +43,8 @@ private fun openInIdeaProject(project: Project?, module: Module, fileName: Strin
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
val a: Project = null!!
|
||||
a.basePath
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.python.community.impl.venv
|
||||
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.diagnostic.fileLogger
|
||||
import com.intellij.python.community.execService.ExecOptions
|
||||
import com.intellij.python.community.execService.ExecService
|
||||
import com.intellij.python.community.execService.HelperName
|
||||
import com.intellij.python.community.execService.WhatToExec
|
||||
@@ -21,6 +22,7 @@ import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import org.jetbrains.annotations.CheckReturnValue
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.pathString
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
|
||||
/**
|
||||
* Create virtual env in [venvDir] using [python].
|
||||
@@ -45,7 +47,7 @@ suspend fun createVenv(
|
||||
}
|
||||
val version = python.validatePythonAndGetVersion().getOr { return failure(it.error) }
|
||||
val helper = if (version.isPy3K) VIRTUALENV_ZIPAPP_NAME else PY_2_VIRTUALENV_ZIPAPP_NAME
|
||||
execService.execGetStdout(WhatToExec.Helper(python, helper = helper), args).getOr { return it }
|
||||
execService.execGetStdout(WhatToExec.Helper(python, helper = helper), args, ExecOptions(timeout = 3.minutes)).getOr { return it }
|
||||
|
||||
|
||||
val venvPython = withContext(Dispatchers.IO) {
|
||||
|
||||
+11
-6
@@ -44,7 +44,7 @@ import kotlin.time.Duration.Companion.minutes
|
||||
class SystemPythonServiceShowCaseTest {
|
||||
|
||||
@Test
|
||||
fun testListPythons(): Unit = timeoutRunBlocking {
|
||||
fun testListPythons(): Unit = timeoutRunBlocking(10.minutes) {
|
||||
for (systemPython in SystemPythonService().findSystemPythons(forceRefresh = true)) {
|
||||
fileLogger().info("Python found: $systemPython")
|
||||
val eelApi = systemPython.pythonBinary.getEelDescriptor().upgrade()
|
||||
@@ -59,18 +59,23 @@ class SystemPythonServiceShowCaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCustomPythonRainyDay(): Unit = timeoutRunBlocking {
|
||||
fun testCustomPythonRainyDay(): Unit = timeoutRunBlocking(10.minutes) {
|
||||
SystemPythonService().registerSystemPython(randomBinary).assertFail()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCustomPythonSunnyDay(@PythonBinaryPath python: Path, @TempDir venvPath: Path): Unit = timeoutRunBlocking {
|
||||
fun testCustomPythonSunnyDay(@PythonBinaryPath python: Path, @TempDir venvPath: Path): Unit = timeoutRunBlocking(10.minutes) {
|
||||
createVenv(python, venvPath).getOrThrow()
|
||||
val python = VirtualEnvReader.Instance.findPythonInPythonRoot(venvPath) ?: error("no python in $venvPath")
|
||||
val newPython = SystemPythonService().registerSystemPython(python).orThrow()
|
||||
var allPythons = SystemPythonService().findSystemPythons()
|
||||
assertThat("No newly registered python returned", allPythons, hasItem(newPython))
|
||||
python.deleteExisting()
|
||||
if (SystemInfo.isWindows) {
|
||||
deleteCheckLocking(python)
|
||||
}
|
||||
else {
|
||||
python.deleteExisting()
|
||||
}
|
||||
|
||||
allPythons = SystemPythonService().findSystemPythons(forceRefresh = true)
|
||||
assertThat("Broken python returned", allPythons, not(hasItem(newPython)))
|
||||
@@ -81,7 +86,7 @@ class SystemPythonServiceShowCaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRefresh(@TestDisposable disposable: Disposable): Unit = timeoutRunBlocking {
|
||||
fun testRefresh(@TestDisposable disposable: Disposable): Unit = timeoutRunBlocking(10.minutes) {
|
||||
val mockProvider = mockk<SystemPythonProvider>()
|
||||
coEvery { mockProvider.findSystemPythons(any()) } returns Result.failure(java.lang.AssertionError("..."))
|
||||
coEvery { mockProvider.uiCustomization } returns null
|
||||
@@ -98,7 +103,7 @@ class SystemPythonServiceShowCaseTest {
|
||||
|
||||
@RegistryKey("python.system.refresh.minutes", "0")
|
||||
@Test
|
||||
fun testDisableCache(@TestDisposable disposable: Disposable): Unit = timeoutRunBlocking {
|
||||
fun testDisableCache(@TestDisposable disposable: Disposable): Unit = timeoutRunBlocking(10.minutes) {
|
||||
val timesToRepeat = 5
|
||||
val mockProvider = mockk<SystemPythonProvider>()
|
||||
coEvery { mockProvider.findSystemPythons(any()) } returns Result.success(emptySet())
|
||||
|
||||
Reference in New Issue
Block a user