From dc601f0dca12d7a03fc213c768e61cf2a5c1f37c Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Tue, 13 Jan 2026 02:22:42 +0100 Subject: [PATCH] tests [python]: Survive FSE when accessing pythons from the store. GitOrigin-RevId: dc13d59d2efd3110b318e6ed9446d33ae15f2d07 --- .../env/systemPython/impl/SystemPythonRootsFixer.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/SystemPythonRootsFixer.kt b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/SystemPythonRootsFixer.kt index 0239f5adbb93..c766116d8e8f 100644 --- a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/SystemPythonRootsFixer.kt +++ b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/SystemPythonRootsFixer.kt @@ -5,16 +5,23 @@ import com.intellij.ide.ApplicationInitializedListener import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.python.community.services.systemPython.SystemPythonService -import org.jetbrains.annotations.TestOnly +import java.nio.file.FileSystemException import kotlin.io.path.pathString -@TestOnly internal class SystemPythonRootsFixer : ApplicationInitializedListener { override suspend fun execute() { val disposable = ApplicationManager.getApplication() val pythonDirs = SystemPythonService() .findSystemPythons() - .map { it.pythonBinary.toRealPath().parent.pathString } + .map { + try { + // It might throw FSE on Windows for pythons installed from store, see WinAppxTools + it.pythonBinary.toRealPath() + } + catch (_: FileSystemException) { + it.pythonBinary + }.parent.pathString + } .toTypedArray() VfsRootAccess.allowRootAccess(disposable, *pythonDirs) }