Test package in a virtualenv on Linux and Windows

This commit is contained in:
Thomas Robitaille
2019-09-10 09:40:19 +01:00
parent fdc2ba8715
commit 40968897a8
3 changed files with 23 additions and 1 deletions
+10
View File
@@ -121,6 +121,16 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
shell(['pip', 'wheel', abs_project_dir, '-w', built_wheel_dir, '--no-deps'] + get_build_verbosity_extra_flags(build_verbosity), env=env)
built_wheel = glob(built_wheel_dir+'/*.whl')[0]
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
shell(['pip', 'install', 'virtualenv'], env=env)
venv_dir = tempfile.mkdtemp()
shell(['virtualenv', venv_dir], env=env)
env['PATH'] = os.pathsep.join([os.path.join(venv_dir, 'Scripts'), env['PATH']])
# check that we are using the Python from the virtual environment
shell(['which', 'python'], env=env)
# install the wheel
shell(['pip', 'install', built_wheel + test_extras], env=env)