From bb5e02399877ea74d5e7937f891f5269b93f602a Mon Sep 17 00:00:00 2001 From: Duk Loi Date: Wed, 20 Apr 2016 10:19:24 -0400 Subject: [PATCH] Install horizon in runtest.sh This patch addresses the case where a user executes runtest.sh to run the units test and fails because horizon is not installed. With inspiration from the Sahara project copied the wrapper code to install horizon in the install_venv.py. Change-Id: I2ee4a89409f8976d1df6dcc144bb975e5fbc95e9 Closes-Bug: #1570443 --- tools/install_venv.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/install_venv.py b/tools/install_venv.py index 8550e2c..bcb1f93 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -32,6 +32,7 @@ VENV = os.path.join(ROOT, '.venv') WITH_VENV = os.path.join(ROOT, 'tools', 'with_venv.sh') PIP_REQUIRES = os.path.join(ROOT, 'requirements.txt') TEST_REQUIRES = os.path.join(ROOT, 'test-requirements.txt') +PIP_INSTALL_WRAPPER = os.path.join(ROOT, 'tools', 'pip_install.sh') def die(message, *args): @@ -113,11 +114,16 @@ def pip_install(*args): run_command(args, redirect_output=False) +def pip_install_with_horizon(*args): + args = [WITH_VENV, PIP_INSTALL_WRAPPER, 'unconstrained'] + list(args) + run_command(args, redirect_output=False) + + def install_dependencies(venv=VENV): print "Installing dependencies..." print "(This may take several minutes, don't panic)" - pip_install('-r', TEST_REQUIRES) - pip_install('-r', PIP_REQUIRES) + pip_install_with_horizon('-r', TEST_REQUIRES) + pip_install_with_horizon('-r', PIP_REQUIRES) # Tell the virtual env how to "import dashboard" py = 'python%d.%d' % (sys.version_info[0], sys.version_info[1])