TEST: Sanity check test for --allow-empty flag
This commit is contained in:
@@ -59,3 +59,20 @@ def test_build_identifiers(tmp_path):
|
||||
assert len(expected_wheels) == len(
|
||||
build_identifiers
|
||||
), f"{expected_wheels} vs {build_identifiers}"
|
||||
|
||||
|
||||
def test_allow_empty(tmp_path, build_frontend_env):
|
||||
project_dir = tmp_path / "project"
|
||||
basic_project.generate(project_dir)
|
||||
|
||||
# Sanity check - --allow-empty should cause a no-op build to complete
|
||||
# without error
|
||||
build_frontend_env["CIBW_BUILD"] = "BUILD_NOTHING_AT_ALL"
|
||||
|
||||
# build the wheels
|
||||
actual_wheels = utils.cibuildwheel_run(
|
||||
project_dir, add_env=build_frontend_env,
|
||||
add_args=["--allow-empty"])
|
||||
|
||||
# check that the expected wheels are produced
|
||||
expected_wheels = utils.expected_wheels("spam", "0.1.0")
|
||||
|
||||
+6
-2
@@ -44,7 +44,7 @@ def cibuildwheel_get_build_identifiers(project_path, env=None, *, prerelease_pyt
|
||||
return cmd_output.strip().split("\n")
|
||||
|
||||
|
||||
def cibuildwheel_run(project_path, package_dir=".", env=None, add_env=None, output_dir=None):
|
||||
def cibuildwheel_run(project_path, package_dir=".", env=None, add_env=None, output_dir=None, add_args=None):
|
||||
"""
|
||||
Runs cibuildwheel as a subprocess, building the project at project_path.
|
||||
|
||||
@@ -57,6 +57,7 @@ def cibuildwheel_run(project_path, package_dir=".", env=None, add_env=None, outp
|
||||
:param add_env: environment used to update env
|
||||
:param output_dir: directory where wheels are saved. If None, a temporary
|
||||
directory will be used for the duration of the command.
|
||||
:param add_args: Additional command-line arguments to pass to cibuildwheel.
|
||||
:return: list of built wheels (file names).
|
||||
"""
|
||||
if env is None:
|
||||
@@ -64,6 +65,9 @@ def cibuildwheel_run(project_path, package_dir=".", env=None, add_env=None, outp
|
||||
# If present in the host environment, remove the MACOSX_DEPLOYMENT_TARGET for consistency
|
||||
env.pop("MACOSX_DEPLOYMENT_TARGET", None)
|
||||
|
||||
if add_args is None:
|
||||
add_args = []
|
||||
|
||||
if add_env is not None:
|
||||
env.update(add_env)
|
||||
|
||||
@@ -77,7 +81,7 @@ def cibuildwheel_run(project_path, package_dir=".", env=None, add_env=None, outp
|
||||
"--output-dir",
|
||||
str(output_dir or tmp_output_dir),
|
||||
str(package_dir),
|
||||
],
|
||||
] + add_args,
|
||||
env=env,
|
||||
cwd=project_path,
|
||||
check=True,
|
||||
|
||||
Reference in New Issue
Block a user