From ffb372aec73d119f03810c1d7816f6278fe14afe Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 24 Jul 2025 13:20:19 -0500 Subject: [PATCH] PYTHON-5027 Test Windows with Python 3.14t (#2444) --- .evergreen/generated_configs/variants.yml | 9 +++++++++ .evergreen/scripts/generate_config.py | 6 +++--- .evergreen/scripts/generate_config_utils.py | 13 ++++++------- pyproject.toml | 3 +++ test/__init__.py | 2 +- test/asynchronous/__init__.py | 2 +- test/asynchronous/helpers.py | 2 +- test/asynchronous/test_comment.py | 2 +- test/asynchronous/test_session.py | 2 +- test/asynchronous/unified_format.py | 2 +- test/asynchronous/utils.py | 2 +- test/asynchronous/utils_spec_runner.py | 2 +- test/helpers.py | 2 +- test/test_bson_binary_vector.py | 3 +-- test/test_bson_corpus.py | 3 +-- test/test_comment.py | 2 +- test/test_session.py | 2 +- test/unified_format.py | 2 +- test/utils.py | 2 +- test/utils_shared.py | 2 +- test/utils_spec_runner.py | 2 +- tools/convert_test_to_async.py | 4 ++-- 22 files changed, 40 insertions(+), 31 deletions(-) diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index e98b0d342..d4726a22a 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -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 diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index a30beb1d3..c27cfe130 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -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" 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) diff --git a/.evergreen/scripts/generate_config_utils.py b/.evergreen/scripts/generate_config_utils.py index 62ea982cd..e676200d3 100644 --- a/.evergreen/scripts/generate_config_utils.py +++ b/.evergreen/scripts/generate_config_utils.py @@ -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}") diff --git a/pyproject.toml b/pyproject.toml index fb2dd5813..e7e316190 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 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