fix: error if build selectors are empty

This commit is contained in:
Henry Fredrick Schreiner
2021-01-22 13:01:00 -05:00
committed by Henry Schreiner
parent 27a0053386
commit 61b94434b2
5 changed files with 47 additions and 3 deletions
+23
View File
@@ -11,6 +11,7 @@ from cibuildwheel.util import BuildSelector
# CIBW_PLATFORM is tested in main_platform_test.py
@pytest.mark.allow_empty('windows')
def test_output_dir(platform, intercepted_build_args, monkeypatch):
OUTPUT_DIR = Path('some_output_dir')
@@ -21,12 +22,14 @@ def test_output_dir(platform, intercepted_build_args, monkeypatch):
assert intercepted_build_args.args[0].output_dir == OUTPUT_DIR
@pytest.mark.allow_empty('windows')
def test_output_dir_default(platform, intercepted_build_args, monkeypatch):
main()
assert intercepted_build_args.args[0].output_dir == Path('wheelhouse')
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('also_set_environment', [False, True])
def test_output_dir_argument(also_set_environment, platform, intercepted_build_args, monkeypatch):
OUTPUT_DIR = Path('some_output_dir')
@@ -40,6 +43,7 @@ def test_output_dir_argument(also_set_environment, platform, intercepted_build_a
assert intercepted_build_args.args[0].output_dir == OUTPUT_DIR
@pytest.mark.allow_empty
def test_build_selector(platform, intercepted_build_args, monkeypatch):
BUILD = 'some build* *-selector'
SKIP = 'some skip* *-selector'
@@ -57,6 +61,16 @@ def test_build_selector(platform, intercepted_build_args, monkeypatch):
# Unit tests for BuildSelector are in build_selector_test.py
def test_empty_selector(platform, intercepted_build_args, monkeypatch):
monkeypatch.setenv('CIBW_SKIP', '*')
with pytest.raises(SystemExit) as e:
main()
assert e.value.code == 3
@pytest.mark.allow_empty
@pytest.mark.parametrize('architecture, image, full_image', [
('x86_64', None, 'quay.io/pypa/manylinux2010_x86_64:*'),
('x86_64', 'manylinux1', 'quay.io/pypa/manylinux1_x86_64:*'),
@@ -100,6 +114,7 @@ def get_default_repair_command(platform):
raise ValueError('Unknown platform', platform)
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('repair_command', [None, 'repair', 'repair -w {dest_dir} {wheel}'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_repair_command(repair_command, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -116,6 +131,7 @@ def test_repair_command(repair_command, platform_specific, platform, intercepted
assert intercepted_build_args.args[0].repair_command == expected_repair
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('environment', [
{},
{'something': 'value'},
@@ -137,6 +153,7 @@ def test_environment(environment, platform_specific, platform, intercepted_build
assert intercepted_environment.as_dictionary(prev_environment={}) == environment
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('test_requires', [None, 'requirement other_requirement'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_test_requires(test_requires, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -152,6 +169,7 @@ def test_test_requires(test_requires, platform_specific, platform, intercepted_b
assert intercepted_build_args.args[0].test_requires == (test_requires or '').split()
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('test_extras', [None, 'extras'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_test_extras(test_extras, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -167,6 +185,7 @@ def test_test_extras(test_extras, platform_specific, platform, intercepted_build
assert intercepted_build_args.args[0].test_extras == ('[' + test_extras + ']' if test_extras else '')
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('test_command', [None, 'test --command'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_test_command(test_command, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -182,6 +201,7 @@ def test_test_command(test_command, platform_specific, platform, intercepted_bui
assert intercepted_build_args.args[0].test_command == test_command
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('before_build', [None, 'before --build'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_before_build(before_build, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -197,6 +217,7 @@ def test_before_build(before_build, platform_specific, platform, intercepted_bui
assert intercepted_build_args.args[0].before_build == before_build
@pytest.mark.allow_empty('windows')
@pytest.mark.parametrize('build_verbosity', [None, 0, 2, -2, 4, -4])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_build_verbosity(build_verbosity, platform_specific, platform, intercepted_build_args, monkeypatch):
@@ -213,6 +234,7 @@ def test_build_verbosity(build_verbosity, platform_specific, platform, intercept
assert intercepted_build_args.args[0].build_verbosity == expected_verbosity
@pytest.mark.allow_empty
@pytest.mark.parametrize('option_name', ['CIBW_BUILD', 'CIBW_SKIP'])
@pytest.mark.parametrize('option_value, build_selector_patterns', [
('*-manylinux1_*', ['*-manylinux_*']),
@@ -234,6 +256,7 @@ def test_build_selector_migrations(intercepted_build_args, monkeypatch, option_n
assert intercepted_build_selector.skip_patterns == build_selector_patterns
@pytest.mark.allow_empty
@pytest.mark.parametrize('before_all', ["", None, 'test text'])
@pytest.mark.parametrize('platform_specific', [False, True])
def test_before_all(before_all, platform_specific, platform, intercepted_build_args, monkeypatch):