Skip to content

PYTHON-5027 Test Windows with Python 3.14t #2444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ buildvariants:
expansions:
PYTHON_BINARY: /Library/Frameworks/PythonT.Framework/Versions/3.13/bin/python3t
tags: []
- name: free-threaded-win64-python3.14t
tasks:
- name: .free-threading
display_name: Free-threaded Win64 Python3.14t
run_on:
- windows-64-vsMulti-small
expansions:
PYTHON_BINARY: C:/python/Python314/python3.14t.exe
tags: []

# Green framework tests
- name: green-eventlet-rhel8
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ 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
python = "3.14t"
else:
python = "3.13t"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to avoid testing 3.14t on other platforms?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deferred that to PYTHON-5454

tasks = [".free-threading"]
tags = []
if host_name == "rhel8":
tags.append("pr")
host = HOSTS[host_name]
python = "3.13t"
display_name = get_variant_name("Free-threaded", host, python=python)
variant = create_variant(tasks, display_name, tags=tags, python=python, host=host)
variants.append(variant)
Expand Down
13 changes: 6 additions & 7 deletions .evergreen/scripts/generate_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,17 @@ def get_python_binary(python: str, host: Host) -> str:
base = "C:/python/32"
else:
base = "C:/python"
python = python.replace(".", "")
if python == "313t":
return f"{base}/Python313/python3.13t.exe"
return f"{base}/Python{python}/python.exe"
python_dir = python.replace(".", "").replace("t", "")
return f"{base}/Python{python_dir}/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"
bin_name = "python3t" if "t" in python else "python3"
python_dir = python.replace("t", "")
framework_dir = "PythonT" if "t" in python else "Python"
return f"/Library/Frameworks/{framework_dir}.Framework/Versions/{python_dir}/bin/{bin_name}"

raise ValueError(f"no match found for python {python} on {name}")

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ filterwarnings = [
"module:Wire protocol compression with:UserWarning",
"module:GridIn property:DeprecationWarning",
"module:GridOut property:DeprecationWarning",
# pytest-asyncio known issue: https://github.com/pytest-dev/pytest-asyncio/issues/1032
"module:.*WindowsSelectorEventLoopPolicy:DeprecationWarning",
"module:.*et_event_loop_policy:DeprecationWarning",
# TODO: Remove as part of PYTHON-3923.
"module:unclosed <eventlet.green.ssl.GreenSSLSocket:ResourceWarning",
"module:unclosed <socket.socket:ResourceWarning",
Expand Down
2 changes: 1 addition & 1 deletion test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import traceback
import unittest
import warnings
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction

from pymongo.errors import AutoReconnect
from pymongo.synchronous.uri_parser import parse_uri
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import traceback
import unittest
import warnings
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction

from pymongo.asynchronous.uri_parser import parse_uri
from pymongo.errors import AutoReconnect
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import traceback
import unittest
import warnings
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction

from pymongo._asyncio_task import create_task

Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sys

sys.path[0:0] = [""]
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction
from test.asynchronous import AsyncIntegrationTest, async_client_context, unittest
from test.utils_shared import OvertCommandListener

Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import copy
import sys
import time
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction
from io import BytesIO
from test.asynchronous.helpers import ExceptionCatchingTask
from typing import Any, Callable, List, Set, Tuple
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/unified_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import sys
import time
import traceback
from asyncio import iscoroutinefunction
from collections import defaultdict
from inspect import iscoroutinefunction
from test.asynchronous import (
AsyncIntegrationTest,
async_client_context,
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import threading # Used in the synchronized version of this file
import time
import traceback
from asyncio import iscoroutinefunction
from functools import wraps
from inspect import iscoroutinefunction

from bson.son import SON
from pymongo import AsyncMongoClient
Expand Down
2 changes: 1 addition & 1 deletion test/asynchronous/utils_spec_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import os
import time
import unittest
from asyncio import iscoroutinefunction
from collections import abc
from inspect import iscoroutinefunction
from test.asynchronous import AsyncIntegrationTest, async_client_context, client_knobs
from test.asynchronous.helpers import ConcurrentRunner
from test.utils_shared import (
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import traceback
import unittest
import warnings
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction

from pymongo._asyncio_task import create_task

Expand Down
3 changes: 1 addition & 2 deletions test/test_bson_binary_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from __future__ import annotations

import binascii
import codecs
import struct
from pathlib import Path
from test import unittest
Expand Down Expand Up @@ -111,7 +110,7 @@ def run_test(self):

def create_tests():
for filename in _TEST_PATH.glob("*.json"):
with codecs.open(str(filename), encoding="utf-8") as test_file:
with open(str(filename), encoding="utf-8") as test_file:
test_method = create_test(json_util.loads(test_file.read()))
setattr(TestBSONBinaryVector, "test_" + filename.stem, test_method)

Expand Down
3 changes: 1 addition & 2 deletions test/test_bson_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from __future__ import annotations

import binascii
import codecs
import functools
import glob
import json
Expand Down Expand Up @@ -227,7 +226,7 @@ def run_test(self):
def create_tests():
for filename in glob.glob(os.path.join(_TEST_PATH, "*.json")):
test_suffix, _ = os.path.splitext(os.path.basename(filename))
with codecs.open(filename, encoding="utf-8") as bson_test_file:
with open(filename, encoding="utf-8") as bson_test_file:
test_method = create_test(json.load(bson_test_file))
setattr(TestBSONCorpus, "test_" + test_suffix, test_method)

Expand Down
2 changes: 1 addition & 1 deletion test/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sys

sys.path[0:0] = [""]
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction
from test import IntegrationTest, client_context, unittest
from test.utils_shared import OvertCommandListener

Expand Down
2 changes: 1 addition & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import copy
import sys
import time
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction
from io import BytesIO
from test.helpers import ExceptionCatchingTask
from typing import Any, Callable, List, Set, Tuple
Expand Down
2 changes: 1 addition & 1 deletion test/unified_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import sys
import time
import traceback
from asyncio import iscoroutinefunction
from collections import defaultdict
from inspect import iscoroutinefunction
from test import (
IntegrationTest,
client_context,
Expand Down
2 changes: 1 addition & 1 deletion test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import threading # Used in the synchronized version of this file
import time
import traceback
from asyncio import iscoroutinefunction
from functools import wraps
from inspect import iscoroutinefunction

from bson.son import SON
from pymongo import MongoClient
Expand Down
2 changes: 1 addition & 1 deletion test/utils_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import threading
import unittest
import warnings
from asyncio import iscoroutinefunction
from collections import abc, defaultdict
from functools import partial
from inspect import iscoroutinefunction
from test import client_context
from test.asynchronous.utils import async_wait_until
from test.utils import wait_until
Expand Down
2 changes: 1 addition & 1 deletion test/utils_spec_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import os
import time
import unittest
from asyncio import iscoroutinefunction
from collections import abc
from inspect import iscoroutinefunction
from test import IntegrationTest, client_context, client_knobs
from test.helpers import ConcurrentRunner
from test.utils_shared import (
Expand Down
4 changes: 2 additions & 2 deletions tools/convert_test_to_async.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import asyncio
import inspect
import sys

from pymongo import AsyncMongoClient
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_async_methods() -> set[str]:
for k, v in vars(x).items()
if callable(v)
and not isinstance(v, classmethod)
and asyncio.iscoroutinefunction(v)
and inspect.iscoroutinefunction(v)
and v.__name__[0] != "_"
}
result = result | methods
Expand Down
Loading