From 2d934b669a81533bc93a35af837d926149d46a72 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Mon, 13 May 2024 21:35:45 +0200 Subject: [PATCH] TST: install pip 24.1b1 or later when on Python 3.13t Earlier pip releases do not recognize the free-threading ABI flag. --- tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 80303a14f..c4ca472ff 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,6 +10,7 @@ import shutil import subprocess import sys +import sysconfig import tempfile import warnings @@ -77,6 +78,7 @@ def tmp_path_session(tmp_path_factory): class VEnv(EnvBuilder): def __init__(self, env_dir): super().__init__(symlinks=True, with_pip=True) + # This warning is mistakenly generated by CPython 3.11.0 # https://github.com/python/cpython/pull/98743 with warnings.catch_warnings(): @@ -84,6 +86,10 @@ def __init__(self, env_dir): warnings.filterwarnings('ignore', 'check_home argument is deprecated and ignored.', DeprecationWarning) self.create(env_dir) + # Free-threaded Python 3.13 requires pip 24.1b1 or later. + if sysconfig.get_config_var('Py_GIL_DISABLED'): + self.pip('install', '--upgrade', 'pip >= 24.1b1') + def ensure_directories(self, env_dir): context = super().ensure_directories(env_dir) # Store the path to the venv Python interpreter. There does