PYTHON-4840 Add evergreen tests for free-threaded Python 3.13t (#2048)

This commit is contained in:
Steven Silvester 2025-01-07 12:48:28 -06:00 committed by GitHub
parent da8c7aa4e0
commit c40283ed09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 76 additions and 1 deletions

View File

@ -116,7 +116,6 @@ functions:
content_type: text/html
display_name: "Coverage Report HTML"
"upload mo artifacts":
- command: ec2.assume_role
params:
@ -300,6 +299,15 @@ functions:
- .evergreen/scripts/run-with-env.sh
- .evergreen/scripts/run-tests.sh
"run direct tests":
- command: subprocess.exec
type: test
params:
working_dir: "src"
binary: bash
include_expansions_in_env: ["PYTHON_BINARY"]
args: [ .evergreen/scripts/run-direct-tests.sh ]
"run enterprise auth tests":
- command: subprocess.exec
type: test
@ -920,6 +928,15 @@ tasks:
commands:
- func: "run tests"
- name: "free-threading"
tags: ["free-threading"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "8.0"
TOPOLOGY: "replica_set"
- func: "run direct tests"
- name: "atlas-connect"
tags: ["atlas-connect"]
commands:

View File

@ -627,6 +627,32 @@ buildvariants:
AUTH: auth
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
# Free threaded tests
- name: free-threaded-rhel8-python3.13t
tasks:
- name: .free-threading
display_name: Free-threaded RHEL8 Python3.13t
run_on:
- rhel87-small
expansions:
PYTHON_BINARY: /opt/python/3.13t/bin/python3
- name: free-threaded-macos-python3.13t
tasks:
- name: .free-threading
display_name: Free-threaded macOS Python3.13t
run_on:
- macos-14
expansions:
PYTHON_BINARY: /Library/Frameworks/PythonT.Framework/Versions/3.13/bin/python3t
- name: free-threaded-macos-arm64-python3.13t
tasks:
- name: .free-threading
display_name: Free-threaded macOS Arm64 Python3.13t
run_on:
- macos-14-arm64
expansions:
PYTHON_BINARY: /Library/Frameworks/PythonT.Framework/Versions/3.13/bin/python3t
# Green framework tests
- name: green-eventlet-rhel8-python3.9
tasks:

View File

@ -146,12 +146,16 @@ def get_python_binary(python: str, host: Host) -> str:
else:
base = "C:/python"
python = python.replace(".", "")
if python == "313t":
return f"{base}/Python313/python3.13t.exe"
return f"{base}/Python{python}/python.exe"
if name in ["rhel8", "ubuntu22", "ubuntu20", "rhel7"]:
return f"/opt/python/{python}/bin/python3"
if name in ["macos", "macos-arm64"]:
if python == "3.13t":
return "/Library/Frameworks/PythonT.Framework/Versions/3.13/bin/python3t"
return f"/Library/Frameworks/Python.Framework/Versions/{python}/bin/python3"
raise ValueError(f"no match found for python {python} on {name}")
@ -318,6 +322,21 @@ def create_server_variants() -> list[BuildVariant]:
return variants
def create_free_threaded_variants() -> list[BuildVariant]:
variants = []
for host_name in ("rhel8", "macos", "macos-arm64", "win64"):
if host_name == "win64":
# TODO: PYTHON-5027
continue
tasks = [".free-threading"]
host = HOSTS[host_name]
python = "3.13t"
display_name = get_display_name("Free-threaded", host, python=python)
variant = create_variant(tasks, display_name, python=python, host=host)
variants.append(variant)
return variants
def create_encryption_variants() -> list[BuildVariant]:
variants = []
tags = ["encryption_tag"]

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -x
. .evergreen/utils.sh
. .evergreen/scripts/env.sh
createvirtualenv "$PYTHON_BINARY" .venv
export PYMONGO_C_EXT_MUST_BUILD=1
pip install -e ".[test]"
pytest -v

View File

@ -16,6 +16,7 @@ PyMongo 4.11 brings a number of changes including:
- pymongocrypt>=1.12 is now required for :ref:`In-Use Encryption` support.
- Added support for free-threaded Python with the GIL disabled. For more information see:
`Free-threaded CPython <https://docs.python.org/3.13/whatsnew/3.13.html#whatsnew313-free-threaded-cpython>`_.
We do not yet support free-threaded Python on Windows (`PYTHON-5027`_) or with In-Use Encryption (`PYTHON-5024`_).
- :attr:`~pymongo.asynchronous.mongo_client.AsyncMongoClient.address` and
:attr:`~pymongo.mongo_client.MongoClient.address` now correctly block when called on unconnected clients
until either connection succeeds or a server selection timeout error is raised.
@ -42,6 +43,8 @@ See the `PyMongo 4.11 release notes in JIRA`_ for the list of resolved issues
in this release.
.. _PyMongo 4.11 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=40784
.. _PYTHON-5027: https://jira.mongodb.org/browse/PYTHON-5027
.. _PYTHON-5024: https://jira.mongodb.org/browse/PYTHON-5024
Changes in Version 4.10.1 (2024/10/01)
--------------------------------------