Making run_test.sh python version and directory
agnostic Refactored some of the shell scripts to handle being run from another directory, as well as to not force the use of 2.6 edit: format the comments Change-Id: Id92b9dc82743598b7c570e431cad423c8a2ee95d
This commit is contained in:
parent
2355a4b036
commit
78dbb64366
@ -33,8 +33,9 @@ function process_option {
|
||||
esac
|
||||
}
|
||||
|
||||
base_dir=$(dirname $0)
|
||||
venv=.kong-venv
|
||||
with_venv=tools/with_venv.sh
|
||||
with_venv=../tools/with_venv.sh
|
||||
always_venv=0
|
||||
never_venv=0
|
||||
force=0
|
||||
@ -59,7 +60,7 @@ function run_pep8 {
|
||||
${wrapper} pep8 $PEP8_OPTIONS $PEP8_INCLUDE || exit 1
|
||||
}
|
||||
NOSETESTS="env python run_tests.py $noseargs"
|
||||
|
||||
function setup_venv {
|
||||
if [ $never_venv -eq 0 ]
|
||||
then
|
||||
# Remove the virtual environment if --force used
|
||||
@ -84,10 +85,13 @@ then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $just_pep8 -eq 1 ]; then
|
||||
run_pep8
|
||||
exit
|
||||
fi
|
||||
|
||||
cd $base_dir
|
||||
setup_venv
|
||||
run_tests || exit
|
||||
|
@ -26,15 +26,15 @@ done
|
||||
echo $test_opts
|
||||
|
||||
function run_tests {
|
||||
base_dir=$(dirname $0)
|
||||
for test_dir in $tests
|
||||
do
|
||||
cd $test_dir
|
||||
test_cmd="./run_tests.sh ${test_opts}"
|
||||
test_cmd="${base_dir}/${test_dir}/run_tests.sh ${test_opts}"
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo $test_cmd
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
$test_cmd
|
||||
cd ..
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,10 @@ def install_dependencies(venv=VENV):
|
||||
run_command([venv_tool, 'pip', 'install', '-E', venv, '-r', PIP_REQUIRES],
|
||||
redirect_output=False)
|
||||
|
||||
python_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
|
||||
|
||||
# Tell the virtual env how to "import glance"
|
||||
pthfile = os.path.join(venv, "lib", "python2.6", "site-packages",
|
||||
pthfile = os.path.join(venv, "lib", python_version, "site-packages",
|
||||
"glance.pth")
|
||||
f = open(pthfile, 'w')
|
||||
f.write("%s\n" % ROOT)
|
||||
|
Loading…
Reference in New Issue
Block a user