Python tests: timeout increased (venv might be slow on some agents)

GitOrigin-RevId: 49cb95c758ce51743e8e1c4c67b79f20b19ceef4
This commit is contained in:
Ilya.Kazakevich
2025-04-02 21:38:42 +00:00
committed by intellij-monorepo-bot
parent df4d3b4c88
commit baf30ce79a
3 changed files with 17 additions and 7 deletions
@@ -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())