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
+9
View File
@@ -85,6 +85,15 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
fi
delocated_wheel=(/tmp/delocated_wheel/*.whl)
# Set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
pip install virtualenv
virtualenv tmp-test-env
source tmp-test-env/bin/activate
# Check that we are using the Python from the virtual environment
which python
# Install the wheel we just built
"$PYBIN/pip" install "$delocated_wheel"{test_extras}
+4 -1
View File
@@ -121,11 +121,14 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
call(['delocate-wheel', '-w', '/tmp/delocated_wheel', built_wheel], env=env)
delocated_wheel = glob('/tmp/delocated_wheel/*.whl')[0]
# set up a virtual environment to install and test from
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
call(['pip', 'install', 'virtualenv'], env=env)
venv_dir = tempfile.mkdtemp()
call(['virtualenv', venv_dir], env=env)
env['PATH'] = os.pathsep.join([os.path.join(venv_dir, 'bin'), env['PATH']])
# check that we are using the Python from the virtual environment
call(['which', 'python'], env=env)
# install the wheel
+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)