[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>

GitOrigin-RevId: 92e35a21b76cc6fc29c5cf1682f3f357117f7178
This commit is contained in:
Egor Eliseev
2025-03-18 15:15:00 +00:00
committed by intellij-monorepo-bot
parent c4e72cac0b
commit f348f0ecb1
@@ -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 {