Rework tests check all wheels produced against a reference list

Also, wrap the cibuildwheel call to make building env easier
This commit is contained in:
Joe Rickerby
2019-04-23 22:15:02 +01:00
parent e360a04dc1
commit e87032c830
8 changed files with 126 additions and 146 deletions
+10 -14
View File
@@ -1,22 +1,18 @@
import subprocess, sys, os
from glob import glob
import os
import utils
def test():
project_dir = os.path.dirname(__file__)
# set up the environment
env = os.environ.copy()
# write python version information to a temporary file, this is checked
# in setup.py
env.update({
# build the wheels
utils.run_cibuildwheel(project_dir, add_env={
# write python version information to a temporary file, this is
# checked in setup.py
'CIBW_BEFORE_BUILD': '''python -c "import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('/tmp/pythonexecutable.txt', 'w').write(sys.executable)"''',
'CIBW_BEFORE_BUILD_WINDOWS': '''python -c "import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('c:\\pythonexecutable.txt', 'w').write(sys.executable)"''',
})
# build the wheels
subprocess.check_call([sys.executable, '-m', 'cibuildwheel', project_dir], env=env)
# check that we got the right number of built wheels
expected_identifiers = utils.cibuildwheel_get_build_identifiers(project_dir)
built_wheels = glob('wheelhouse/*.whl')
assert len(built_wheels) == len(expected_identifiers)
# also check that we got the right wheels
expected_wheels = utils.expected_wheels('spam', '0.1.0')
actual_wheels = os.listdir('wheelhouse')
assert set(actual_wheels) == set(expected_wheels)