Copilot commented on code in PR #4691: URL: https://github.com/apache/arrow-adbc/pull/4691#discussion_r3793950686
########## ci/scripts/python_wheel_windows_test.ps1: ########## @@ -0,0 +1,99 @@ +#!/usr/bin/env pwsh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +param( + [Parameter(Mandatory = $true)] + [string]$SourceDir, + [Parameter(Mandatory = $true)] + [ValidateSet("amd64", "arm64")] + [string]$Architecture +) + +$ErrorActionPreference = "Stop" +$Components = @( + "adbc_driver_manager", + "adbc_driver_flightsql", + "adbc_driver_postgresql", + "adbc_driver_sqlite" +) +$PythonTag = python -c "import sysconfig; print('cp' + sysconfig.get_python_version().replace('.', ''))" +if (-not $?) { throw "Failed to determine the Python tag" } +# https://github.com/python/cpython/issues/127405: unlike Unix, Windows does not +# expose free-threading through abiflags, so use Py_GIL_DISABLED instead. +$PythonFlags = python -c "import sysconfig; print('t' if sysconfig.get_config_var('Py_GIL_DISABLED') else '')" +if (-not $?) { throw "Failed to determine whether Python is free-threaded" } +$PythonTag = $PythonTag.Trim() +$PythonFlags = $PythonFlags.Trim() +if ($PythonFlags.Contains("t")) { + $env:PYTHON_GIL = "0" +} + +Write-Host "=== ($PythonTag$PythonFlags) Installing wheels ===" + +foreach ($Component in $Components) { + if ($Component -eq "adbc_driver_manager") { + $WheelPattern = "*-$PythonTag-$PythonTag$PythonFlags-*.whl" + } else { + $WheelPattern = "*-py3-none-*.whl" + } + + $WheelDir = Join-Path $SourceDir "python/$Component/repaired_wheels" + $Wheels = @(Get-ChildItem -Path (Join-Path $WheelDir $WheelPattern)) + if ($Wheels.Count -ne 1) { + throw "Expected one $Component wheel matching $WheelPattern, found $($Wheels.Count)" + } + + python -m pip install --no-deps --force-reinstall $Wheels[0].FullName + if (-not $?) { throw "Failed to install the $Component wheel" } +} + +python -m pip install pytest typing-extensions +if (-not $?) { throw "Failed to install Python test dependencies" } + +foreach ($Component in $Components) { + python -c "import $Component; import $Component.dbapi" + if (-not $?) { throw "Failed to import $Component" } +} + +if ($PythonFlags.Contains("t")) { + Write-Host "=== Testing free-threaded driver manager without PyArrow or Polars ===" + python -m pytest -vvx --import-mode append ` + -k "unknown_driver or missing_platform or bad" ` + (Join-Path $SourceDir "python/adbc_driver_manager/tests/test_manifest.py") Review Comment: The free-threaded path only selects the three failure cases, so neither the `cp314t` driver-manager wheel nor any bundled driver is exercised by a successful connection. `test_manifest.py` also contains two self-contained SQLite query tests that need no PyArrow or Polars; run the whole file here so the free-threaded wheels cannot pass on imports/error handling alone. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
