def test_before_build(before_build, platform_specific, platform, intercepted_build_args, monkeypatch): if before_build is not None: if platform_specific: monkeypatch.setenv('CIBW_BEFORE_BUILD_' + platform.upper(), before_build) monkeypatch.setenv('CIBW_BEFORE_BUILD', 'overwritten') else: monkeypatch.setenv('CIBW_BEFORE_BUILD', before_build) main() assert intercepted_build_args.kwargs['before_build'] == before_build
def test_test_command(test_command, platform_specific, platform, intercepted_build_args, monkeypatch): if test_command is not None: if platform_specific: monkeypatch.setenv('CIBW_TEST_COMMAND_' + platform.upper(), test_command) monkeypatch.setenv('CIBW_TEST_COMMAND', 'overwritten') else: monkeypatch.setenv('CIBW_TEST_COMMAND', test_command) main() assert intercepted_build_args.kwargs['test_command'] == test_command
def test_test_requires(test_requires, platform_specific, platform, intercepted_build_args, monkeypatch): if test_requires is not None: if platform_specific: monkeypatch.setenv('CIBW_TEST_REQUIRES_' + platform.upper(), test_requires) monkeypatch.setenv('CIBW_TEST_REQUIRES', 'overwritten') else: monkeypatch.setenv('CIBW_TEST_REQUIRES', test_requires) main() assert intercepted_build_args.kwargs['test_requires'] == (test_requires or '').split()
def test_repair_command(repair_command, platform_specific, platform, intercepted_build_args, monkeypatch): if repair_command is not None: if platform_specific: monkeypatch.setenv('CIBW_REPAIR_WHEEL_COMMAND_' + platform.upper(), repair_command) monkeypatch.setenv('CIBW_REPAIR_WHEEL_COMMAND', 'overwritten') else: monkeypatch.setenv('CIBW_REPAIR_WHEEL_COMMAND', repair_command) main() expected_repair = repair_command or get_default_repair_command(platform) assert intercepted_build_args.kwargs['repair_command'] == expected_repair
def test_build_verbosity(build_verbosity, platform_specific, platform, intercepted_build_args, monkeypatch): if build_verbosity is not None: if platform_specific: monkeypatch.setenv('CIBW_BUILD_VERBOSITY_' + platform.upper(), str(build_verbosity)) monkeypatch.setenv('CIBW_BUILD_VERBOSITY', 'overwritten') else: monkeypatch.setenv('CIBW_BUILD_VERBOSITY', str(build_verbosity)) main() expected_verbosity = max(-3, min(3, int(build_verbosity or 0))) assert intercepted_build_args.kwargs[ 'build_verbosity'] == expected_verbosity
def test_test_extras(test_extras, platform_specific, platform, intercepted_build_args, monkeypatch): if test_extras is not None: if platform_specific: monkeypatch.setenv('CIBW_TEST_EXTRAS_' + platform.upper(), test_extras) monkeypatch.setenv('CIBW_TEST_EXTRAS', 'overwritten') else: monkeypatch.setenv('CIBW_TEST_EXTRAS', test_extras) main() assert intercepted_build_args.kwargs['test_extras'] == ('[' + test_extras + ']' if test_extras else '')
def test_environment(environment, platform_specific, platform, intercepted_build_args, monkeypatch): env_string = ' '.join( ['{}={}'.format(k, v) for k, v in environment.items()]) if platform_specific: monkeypatch.setenv('CIBW_ENVIRONMENT_' + platform.upper(), env_string) monkeypatch.setenv('CIBW_ENVIRONMENT', 'overwritten') else: monkeypatch.setenv('CIBW_ENVIRONMENT', env_string) main() intercepted_environment = intercepted_build_args.kwargs['environment'] assert isinstance(intercepted_environment, ParsedEnvironment) assert intercepted_environment.as_dictionary( prev_environment={}) == environment