style: apply black via pre-commit run -a

This commit is contained in:
Henry Schreiner
2021-05-03 13:12:36 -04:00
committed by Henry Schreiner
parent 9cbed6a9be
commit 178aaea6c7
53 changed files with 1479 additions and 714 deletions
+32 -18
View File
@@ -10,7 +10,7 @@ basic_project = test_projects.new_c_project()
ALL_MACOS_WHEELS = {
*utils.expected_wheels('spam', '0.1.0', machine_arch='x86_64'),
*utils.expected_wheels('spam', '0.1.0', machine_arch='arm64')
*utils.expected_wheels('spam', '0.1.0', machine_arch='arm64'),
}
@@ -37,10 +37,13 @@ def test_cross_compiled_build(tmp_path):
project_dir = tmp_path / 'project'
basic_project.generate(project_dir)
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_ARCHS': 'x86_64, universal2, arm64',
})
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_ARCHS': 'x86_64, universal2, arm64',
},
)
expected_wheels = [w for w in ALL_MACOS_WHEELS if 'cp39' in w]
assert set(actual_wheels) == set(expected_wheels)
@@ -56,11 +59,14 @@ def test_cross_compiled_test(tmp_path, capfd, build_universal2):
project_dir = tmp_path / 'project'
basic_project.generate(project_dir)
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_TEST_COMMAND': '''python -c "import platform; print('running tests on ' + platform.machine())"''',
'CIBW_ARCHS': 'universal2' if build_universal2 else 'x86_64 arm64',
})
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_TEST_COMMAND': '''python -c "import platform; print('running tests on ' + platform.machine())"''',
'CIBW_ARCHS': 'universal2' if build_universal2 else 'x86_64 arm64',
},
)
captured = capfd.readouterr()
@@ -69,9 +75,14 @@ def test_cross_compiled_test(tmp_path, capfd, build_universal2):
assert 'running tests on x86_64' in captured.out
assert 'running tests on arm64' not in captured.out
if build_universal2:
assert 'While universal2 wheels can be built on x86_64, the arm64 part of them cannot currently be tested' in captured.err
assert (
'While universal2 wheels can be built on x86_64, the arm64 part of them cannot currently be tested'
in captured.err
)
else:
assert 'While arm64 wheels can be built on x86_64, they cannot be tested' in captured.err
assert (
'While arm64 wheels can be built on x86_64, they cannot be tested' in captured.err
)
elif platform.machine() == 'arm64':
# ensure that tests were run on both x86_64 and arm64
assert 'running tests on x86_64' in captured.out
@@ -97,12 +108,15 @@ def test_universal2_testing(tmp_path, capfd, skip_arm64_test):
project_dir = tmp_path / 'project'
basic_project.generate(project_dir)
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_TEST_COMMAND': '''python -c "import platform; print('running tests on ' + platform.machine())"''',
'CIBW_ARCHS': 'universal2',
'CIBW_TEST_SKIP': '*_universal2:arm64' if skip_arm64_test else '',
})
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
'CIBW_BUILD': 'cp39-*',
'CIBW_TEST_COMMAND': '''python -c "import platform; print('running tests on ' + platform.machine())"''',
'CIBW_ARCHS': 'universal2',
'CIBW_TEST_SKIP': '*_universal2:arm64' if skip_arm64_test else '',
},
)
captured = capfd.readouterr()