Rework custom test machinery to give the individual tests more control

on how they're run, and combine environment.json and check.py
This commit is contained in:
Joe Rickerby
2019-04-22 18:22:43 +01:00
parent ac4b62ca07
commit 21fb27faf7
24 changed files with 237 additions and 114 deletions
+5 -22
View File
@@ -1,28 +1,13 @@
#!/usr/bin/python
from __future__ import print_function
import os, sys, subprocess, shutil, json
from glob import glob
import os, sys, subprocess, shutil
def single_run(test_project):
# load project settings into environment
env_file = os.path.join(test_project, 'environment.json')
project_env = {}
if os.path.exists(env_file):
with open(env_file) as f:
project_env = json.load(f)
# run the build
env = os.environ.copy()
project_env = {str(k): str(v) for k, v in project_env.items()} # unicode not allowed in env
env.update(project_env)
print('Building %s with environment %s' % (test_project, project_env))
subprocess.check_call([sys.executable, '-m', 'cibuildwheel', test_project], env=env)
wheels = glob('wheelhouse/*.whl')
print('%s built successfully. %i wheels built.' % (test_project, len(wheels)))
# check some wheels were actually built
subprocess.check_call([sys.executable, os.path.join(test_project, 'check.py')])
# run the test
subprocess.check_call(
[sys.executable, '-m', 'pytest', '-v', os.path.join(test_project, 'cibuildwheel_test.py')]
)
# clean up
shutil.rmtree('wheelhouse')
@@ -41,5 +26,3 @@ if __name__ == '__main__':
exit(2)
single_run(project_path)
print('Project built successfully.')