From 8c77d5ed410ef9ac8c5aeab28cf121b41bff5456 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 3 Apr 2022 10:51:59 +0100 Subject: [PATCH] Tidy ups, bug fixes --- cibuildwheel/from_sdist.py | 4 ++-- test/test_from_sdist.py | 21 ++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/cibuildwheel/from_sdist.py b/cibuildwheel/from_sdist.py index d0084b58..8bff69a0 100644 --- a/cibuildwheel/from_sdist.py +++ b/cibuildwheel/from_sdist.py @@ -22,7 +22,7 @@ def main() -> None: the package directory. """, ), - epilog="""Any further arguments will be passed on to cibuildwheel.""", + epilog="Any further arguments will be passed on to cibuildwheel.", formatter_class=argparse.RawDescriptionHelpFormatter, ) @@ -65,7 +65,7 @@ def main() -> None: temp_dir_contents = list(temp_dir.iterdir()) - if len(temp_dir_contents) != 1 or not temp_dir_contents[0].is_dir: + if len(temp_dir_contents) != 1 or not temp_dir_contents[0].is_dir(): exit("invalid sdist: didn't contain a single dir") project_dir = temp_dir_contents[0] diff --git a/test/test_from_sdist.py b/test/test_from_sdist.py index fe312fd9..73cc1c04 100644 --- a/test/test_from_sdist.py +++ b/test/test_from_sdist.py @@ -8,9 +8,6 @@ from test.test_projects.base import TestProject from . import test_projects, utils -basic_project = test_projects.new_c_project() - - # utilities @@ -54,6 +51,8 @@ def cibuildwheel_from_sdist_run(sdist_path, add_env=None, config_file=None): def test_simple(tmp_path): + basic_project = test_projects.new_c_project() + # make an sdist of the project sdist_dir = tmp_path / "sdist" sdist_dir.mkdir() @@ -62,9 +61,7 @@ def test_simple(tmp_path): # build the wheels from sdist actual_wheels = cibuildwheel_from_sdist_run( sdist_path, - add_env={ - "CIBW_BUILD": "cp39-*", - }, + add_env={"CIBW_BUILD": "cp39-*"}, ) # check that the expected wheels are produced @@ -73,6 +70,8 @@ def test_simple(tmp_path): def test_external_config_file_argument(tmp_path, capfd): + basic_project = test_projects.new_c_project() + # make an sdist of the project sdist_dir = tmp_path / "sdist" sdist_dir.mkdir() @@ -92,9 +91,7 @@ def test_external_config_file_argument(tmp_path, capfd): # build the wheels from sdist actual_wheels = cibuildwheel_from_sdist_run( sdist_path, - add_env={ - "CIBW_BUILD": "cp39-*", - }, + add_env={"CIBW_BUILD": "cp39-*"}, config_file=config_file, ) @@ -159,12 +156,10 @@ def test_internal_config_file_argument(tmp_path, capfd): sdist_dir.mkdir() sdist_path = make_sdist(project, sdist_dir) - # build the wheels from sdist + # build the wheels from sdist, referencing the config file inside actual_wheels = cibuildwheel_from_sdist_run( sdist_path, - add_env={ - "CIBW_BUILD": "cp39-*", - }, + add_env={"CIBW_BUILD": "cp39-*"}, config_file="{project}/wheel_build_config.toml", )