2019-10-20 20:45:25 +01:00
|
|
|
import os, subprocess
|
|
|
|
|
import pytest
|
2019-04-22 18:22:43 +01:00
|
|
|
import utils
|
|
|
|
|
|
|
|
|
|
def test():
|
2019-04-22 23:13:34 +01:00
|
|
|
project_dir = os.path.dirname(__file__)
|
2019-04-23 22:14:17 +01:00
|
|
|
|
|
|
|
|
# build and test the wheels
|
2019-11-20 22:20:53 +01:00
|
|
|
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
|
2019-04-22 23:23:49 +01:00
|
|
|
'CIBW_TEST_REQUIRES': 'nose',
|
|
|
|
|
# the 'false ||' bit is to ensure this command runs in a shell on
|
|
|
|
|
# mac/linux.
|
|
|
|
|
'CIBW_TEST_COMMAND': 'false || nosetests {project}/test',
|
|
|
|
|
'CIBW_TEST_COMMAND_WINDOWS': 'nosetests {project}/test',
|
|
|
|
|
})
|
2019-09-07 17:38:31 +01:00
|
|
|
|
|
|
|
|
# also check that we got the right wheels
|
|
|
|
|
expected_wheels = utils.expected_wheels('spam', '0.1.0')
|
|
|
|
|
assert set(actual_wheels) == set(expected_wheels)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_extras_require():
|
|
|
|
|
project_dir = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
|
|
# build and test the wheels
|
2019-11-20 22:20:53 +01:00
|
|
|
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
|
2019-09-07 17:38:31 +01:00
|
|
|
'CIBW_TEST_EXTRAS': 'test',
|
|
|
|
|
# the 'false ||' bit is to ensure this command runs in a shell on
|
|
|
|
|
# mac/linux.
|
|
|
|
|
'CIBW_TEST_COMMAND': 'false || nosetests {project}/test',
|
|
|
|
|
'CIBW_TEST_COMMAND_WINDOWS': 'nosetests {project}/test',
|
|
|
|
|
})
|
|
|
|
|
|
2019-04-23 22:14:17 +01:00
|
|
|
# also check that we got the right wheels
|
|
|
|
|
expected_wheels = utils.expected_wheels('spam', '0.1.0')
|
|
|
|
|
assert set(actual_wheels) == set(expected_wheels)
|
2019-10-20 20:45:25 +01:00
|
|
|
|
|
|
|
|
|
2019-11-20 22:20:53 +01:00
|
|
|
def test_failing_test(tmp_path):
|
2019-10-20 20:45:25 +01:00
|
|
|
'''Ensure a failing test causes cibuildwheel to error out and exit'''
|
|
|
|
|
project_dir = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
|
|
with pytest.raises(subprocess.CalledProcessError):
|
2019-11-20 22:20:53 +01:00
|
|
|
utils.cibuildwheel_run(project_dir, output_dir=tmp_path, add_env={
|
2019-10-20 20:45:25 +01:00
|
|
|
'CIBW_TEST_COMMAND': 'false',
|
2019-11-20 22:20:53 +01:00
|
|
|
# manylinux1 has a version of bash that's been shown to have
|
2019-11-09 18:07:46 +00:00
|
|
|
# problems with this, so let's check that.
|
|
|
|
|
'CIBW_MANYLINUX_I686_IMAGE': 'manylinux1',
|
|
|
|
|
'CIBW_MANYLINUX_X86_64_IMAGE': 'manylinux1',
|
2019-10-20 20:45:25 +01:00
|
|
|
})
|
2019-11-20 22:20:53 +01:00
|
|
|
assert len(os.listdir(str(tmp_path))) == 0
|