diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 0feff063..c6a532f9 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -2,7 +2,7 @@ import argparse import os import sys import textwrap -from typing import List, Optional, Set, Union +from typing import List, Set, Union import cibuildwheel import cibuildwheel.linux @@ -15,7 +15,7 @@ from cibuildwheel.typing import PLATFORMS, PlatformName, assert_never from cibuildwheel.util import BuildSelector, Unbuffered, detect_ci_provider -def main(sys_args: Optional[List[str]] = None) -> None: +def main() -> None: platform: PlatformName parser = argparse.ArgumentParser( @@ -98,7 +98,7 @@ def main(sys_args: Optional[List[str]] = None) -> None: help="Enable pre-release Python versions if available.", ) - args = parser.parse_args(args=sys_args, namespace=CommandLineArguments()) + args = parser.parse_args(namespace=CommandLineArguments()) if args.platform != "auto": platform = args.platform diff --git a/unit_test/option_prepare_test.py b/unit_test/option_prepare_test.py index 98a498cd..cadab279 100644 --- a/unit_test/option_prepare_test.py +++ b/unit_test/option_prepare_test.py @@ -1,5 +1,6 @@ import platform as platform_module import subprocess +import sys from contextlib import contextmanager from pathlib import Path from typing import cast @@ -40,9 +41,11 @@ def mock_build_docker(monkeypatch): monkeypatch.setattr("cibuildwheel.util.print_new_wheels", ignore_context_call) -def test_build_default_launches(mock_build_docker, fake_package_dir): +def test_build_default_launches(mock_build_docker, fake_package_dir, monkeypatch): + monkeypatch.setattr(sys, "argv", ["cibuildwheel", "--platform=linux"]) + + main() - main(["--platform=linux"]) build_on_docker = cast(mock.Mock, linux.build_on_docker) assert build_on_docker.call_count == 4 @@ -106,7 +109,10 @@ before-all = "true" ) monkeypatch.chdir(pkg_dir) - main(["--platform=linux"]) + monkeypatch.setattr(sys, "argv", ["cibuildwheel", "--platform=linux"]) + + main() + build_on_docker = cast(mock.Mock, linux.build_on_docker) assert build_on_docker.call_count == 6