summaryrefslogtreecommitdiff
path: root/run_tests.sh
diff options
context:
space:
mode:
authorKui Shi <skuicloud@gmail.com>2013-10-06 16:11:22 +0800
committerKui Shi <skuicloud@gmail.com>2013-10-07 16:05:13 +0800
commit2b5772ab8afeb1f8ab1877ee5695af79caaed27e (patch)
tree1a0d7070a56cd6c449bc5bb9b42bd73aa1f64198 /run_tests.sh
parent9c08d883ea2b729bad4c16c3aefa5bdc23e03174 (diff)
downloadhorizon-2b5772ab8afeb1f8ab1877ee5695af79caaed27e.tar.gz
emit warning while running flake8 without virtual env
run_tests.sh -N -p It will call the flake8 installed on your host to detect PEP8, and the flake8 plugin "OpenStack hacking" may not installed on your host, so this command may not detect the OpenStack Style Commandment supplied by hacking(e.g H202). run_tests.sh -p it will call the flake8 from virtual env, flake8 plugin "OpenStack hacking" installed in virtual env will be triggered. The result from "run_tests.sh -p" should be trusted, and jenkins uses virtual env to run flake8 too. When "-N" is enabled, check whether hacking can be imported, if not, emit warning to stderr to remind user. Test method ----------- Suppose hacking is not installed on your host $ ./run_tests.sh -p no warning $ ./run_tests.sh -p -N emit warning $ source .venv/bin/activate $ ./run_tests.sh -p no warning $ ./run_tests.sh -p -N no warning Close-Bug #1215400 Change-Id: If5125c180a3ebea72dc1fb96817523a6e07b2d66
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh
index 12d5d91f5..bcd308051 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -137,6 +137,15 @@ function run_pylint {
function run_pep8 {
echo "Running flake8 ..."
+ set +o errexit
+ ${command_wrapper} python -c "import hacking" 2>/dev/null
+ no_hacking=$?
+ set -o errexit
+ if [ $never_venv -eq 1 -a $no_hacking -eq 1 ]; then
+ echo "**WARNING**:" >&2
+ echo "OpenStack hacking is not installed on your host. Its detection will be missed." >&2
+ echo "Please install or use virtual env if you need OpenStack hacking detection." >&2
+ fi
DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings ${command_wrapper} flake8
}