From eeff548d968e2ff29c179a6645f8d459cb68b0c5 Mon Sep 17 00:00:00 2001 From: Vitaly Legchilkin Date: Tue, 7 Jul 2026 20:58:38 +0200 Subject: [PATCH] [python] PY-58278 run PyEnvTestCase on vanilla Python 2.7 2.7 has no usable venv (no built-in venv, and virtualenv-py3.pyz/uv reject it), so drop VENV_2_7 and run 2.7 tests on the plain interpreter, matching the JUnit5 env tests (PyDebuggerPython2Test/Python27ProfilerTest). (cherry picked from commit 66722d369a9f2fc9326b23c869b5dbc57a2fcdc5) IJ-MR-210769 GitOrigin-RevId: 1f54f7142ce2575efec24537d29d81d6b7bcc882 --- .../test/env/common/PredefinedPyEnvironments.kt | 16 ++++++---------- .../testSrc/com/jetbrains/env/PyEnvTestCase.java | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/python/python-test-env/common/src/com/intellij/python/test/env/common/PredefinedPyEnvironments.kt b/python/python-test-env/common/src/com/intellij/python/test/env/common/PredefinedPyEnvironments.kt index 4eb37cdc7ba4..58de322858f9 100644 --- a/python/python-test-env/common/src/com/intellij/python/test/env/common/PredefinedPyEnvironments.kt +++ b/python/python-test-env/common/src/com/intellij/python/test/env/common/PredefinedPyEnvironments.kt @@ -16,18 +16,14 @@ import org.jetbrains.annotations.ApiStatus enum class PredefinedPyEnvironments(val spec: PyEnvironmentSpec<*>) { /** - * Python 2.7.18 + * Python 2.7.18 (plain interpreter, no venv). * ID: python2.7 * Tags: python2.7 - * Packages: virtualenv + * + * Python 2.7 has no usable venv: the built-in `venv` module is absent and neither the bundled + * `virtualenv-py3.pyz` nor `uv` can target it. Tests run directly on the interpreter (this is also + * what the JUnit5 env framework does, see `PyDebuggerPython2Test` / `Python27ProfilerTest`). */ - VENV_2_7(venvEnvironment { - pythonVersion = pythonVersion("2.7") - libraries { - +"virtualenv" - } - }), - VANILLA_2_7(pythonEnvironment { pythonVersion = pythonVersion("2.7") }), @@ -223,7 +219,7 @@ enum class PredefinedPyEnvironments(val spec: PyEnvironmentSpec<*>) { * Environment tags for finding which tags an environment supports */ val ENVIRONMENTS_TO_TAGS: Map> = mapOf( - VENV_2_7 to setOf("python2.7"), + VANILLA_2_7 to setOf("python2.7"), VENV_3_8_FULL to setOf( "python3", "python3.8", "pytest", "django", "django2", "behave", "behave-django", "ipython", "ipython780", "skeletons", "tox", "jinja2", "packaging", "nose", diff --git a/python/testSrc/com/jetbrains/env/PyEnvTestCase.java b/python/testSrc/com/jetbrains/env/PyEnvTestCase.java index 5c27168d6f3b..38bf9cd303a4 100644 --- a/python/testSrc/com/jetbrains/env/PyEnvTestCase.java +++ b/python/testSrc/com/jetbrains/env/PyEnvTestCase.java @@ -31,7 +31,7 @@ import java.util.List; import java.util.Set; import static com.intellij.python.test.env.common.PredefinedPyEnvironments.Companion; -import static com.intellij.python.test.env.common.PredefinedPyEnvironments.VENV_2_7; +import static com.intellij.python.test.env.common.PredefinedPyEnvironments.VANILLA_2_7; import static com.intellij.python.test.env.common.PredefinedPyEnvironments.VENV_3_10; import static com.intellij.python.test.env.common.PredefinedPyEnvironments.VENV_3_11; import static com.intellij.python.test.env.common.PredefinedPyEnvironments.VENV_3_12; @@ -88,7 +88,7 @@ public abstract class PyEnvTestCase { * All predefined environments used by PyEnvTestCase by default */ public static final List ALL_ENVIRONMENTS = List.of( - VENV_2_7, + VANILLA_2_7, VENV_3_8_FULL, VENV_3_9, VENV_3_10,