Add ability for test projects to have custom env vars

This commit is contained in:
Joe Rickerby
2017-03-23 11:20:00 +00:00
parent 21c53fed74
commit 747556c417
+18 -3
View File
@@ -1,5 +1,5 @@
from __future__ import print_function
import os, sys, subprocess
import os, sys, subprocess, shutil, json
from glob import glob
# move cwd to the project root
@@ -14,7 +14,22 @@ if len(test_projects) == 0:
print('Testing projects:', test_projects)
for project_path in test_projects:
subprocess.check_call(['cibuildwheel', project_path])
print('%s built successfully.' % project_path)
# load project settings into environment
env = os.environ.copy()
env_file = os.path.join(project_path, 'environment.json')
if os.path.exists(env_file):
with open(env_file) as f:
env.update(json.load(f))
# run the build
subprocess.check_call(['cibuildwheel', project_path], env=env)
wheels = glob('wheelhouse/*.whl')
print('%s built successfully. %i wheels built.' % (project_path, len(wheels)))
# check wheels were actually built
assert len(wheels) >= 4
# clean up
shutil.rmtree('wheelhouse')
print('%d projects built successfully.' % len(test_projects))