[python] Add the ability to set a Python version for PyCharm Debugger Test

Merge-request: IJ-MR-157952
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>
(cherry picked from commit 92e35a21b76cc6fc29c5cf1682f3f357117f7178)

GitOrigin-RevId: 2ef99f40848c11305138165fbf9e11ab396becd3
This commit is contained in:
Egor Eliseev
2025-04-04 17:53:06 +00:00
committed by intellij-monorepo-bot
parent ed5cab527c
commit b98b6a2be6
@@ -33,10 +33,13 @@ data class PyEnvTestSettings(
@TestOnly
@get:JvmName("getPythons")
internal val pythons: List<File> = foldersWithPythons
.asSequence()
.filter { if (PyTestEnvVars.PYCHARM_PY_VERSION.isSet()) it.name.endsWith(PyTestEnvVars.PYCHARM_PY_VERSION.getValue()!!) else true }
.filter(File::exists)
.flatMap { it.listFiles()?.toList() ?: emptyList() }
.plus(additionalInterpreters)
.filter { it.isDirectory && !it.name.startsWith('.') }
.toList()
/**
* Configuration in readable format
@@ -116,7 +119,12 @@ enum class PyTestEnvVars(private val getVarName: (PyTestEnvVars) -> String = { i
/**
* Only run remote-based tests
*/
PYCHARM_RUN_REMOTE;
PYCHARM_RUN_REMOTE,
/**
* Run only on one PY version
*/
PYCHARM_PY_VERSION;
companion object {