From f983ff66a946a42846f2ec29e734a71f88c94cb3 Mon Sep 17 00:00:00 2001 From: Shurong Cao <170531907+CAOShurong@users.noreply.github.com> Date: Wed, 12 Aug 2026 12:55:27 +0800 Subject: [PATCH 1/2] fix: respect configured NuGet package sources --- cibuildwheel/platforms/windows.py | 2 -- unit_test/get_platform_test.py | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/platforms/windows.py b/cibuildwheel/platforms/windows.py index d7df473ef..fe61e762c 100644 --- a/cibuildwheel/platforms/windows.py +++ b/cibuildwheel/platforms/windows.py @@ -81,8 +81,6 @@ def get_nuget_args( package_name, "-Version", version, - "-FallbackSource", - "https://api.nuget.org/v3/index.json", "-OutputDirectory", str(output_directory), ] diff --git a/unit_test/get_platform_test.py b/unit_test/get_platform_test.py index 22bd9d053..2a275c9af 100644 --- a/unit_test/get_platform_test.py +++ b/unit_test/get_platform_test.py @@ -8,7 +8,11 @@ from cibuildwheel.ci import CIProvider, detect_ci_provider from cibuildwheel.errors import FatalError -from cibuildwheel.platforms.windows import PythonConfiguration, setup_setuptools_cross_compile +from cibuildwheel.platforms.windows import ( + PythonConfiguration, + get_nuget_args, + setup_setuptools_cross_compile, +) TYPE_CHECKING = False if TYPE_CHECKING: @@ -30,6 +34,22 @@ def patched_environment( yield +@pytest.mark.parametrize( + ("arch", "free_threaded", "package_name"), + [("AMD64", False, "python"), ("ARM64", True, "pythonarm64-freethreaded")], +) +def test_nuget_args_use_configured_sources( + arch: str, free_threaded: bool, package_name: str, tmp_path: Path +) -> None: + assert get_nuget_args("3.14.1", arch, free_threaded, tmp_path) == [ + package_name, + "-Version", + "3.14.1", + "-OutputDirectory", + str(tmp_path), + ] + + def test_x86(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: environment: dict[str, str] = {} configuration = PythonConfiguration(version="irrelevant", identifier="cp314-win32", url=None) From 51c5d3fc6c22978d9df0345c13465f2492bd561d Mon Sep 17 00:00:00 2001 From: Shurong Cao <170531907+CAOShurong@users.noreply.github.com> Date: Wed, 12 Aug 2026 16:40:46 +0800 Subject: [PATCH 2/2] test: use concise NuGet args name --- unit_test/get_platform_test.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/unit_test/get_platform_test.py b/unit_test/get_platform_test.py index 2a275c9af..9eeb79ecb 100644 --- a/unit_test/get_platform_test.py +++ b/unit_test/get_platform_test.py @@ -38,9 +38,7 @@ def patched_environment( ("arch", "free_threaded", "package_name"), [("AMD64", False, "python"), ("ARM64", True, "pythonarm64-freethreaded")], ) -def test_nuget_args_use_configured_sources( - arch: str, free_threaded: bool, package_name: str, tmp_path: Path -) -> None: +def test_get_nuget_args(arch: str, free_threaded: bool, package_name: str, tmp_path: Path) -> None: assert get_nuget_args("3.14.1", arch, free_threaded, tmp_path) == [ package_name, "-Version",