Refactor run_tests.sh to allow us to run an extra command after the tests.

Run pep8 after unit tests in run_tests.sh.

Fix setup.py to be PEP-8 compliant.
This commit is contained in:
Soren Hansen 2011-01-19 10:50:54 +01:00
parent b9c96efe7e
commit 50ec058cc7
2 changed files with 39 additions and 38 deletions

View File

@ -31,46 +31,46 @@ always_venv=0
never_venv=0 never_venv=0
force=0 force=0
noseargs= noseargs=
wrapper=""
for arg in "$@"; do for arg in "$@"; do
process_option $arg process_option $arg
done done
function run_tests {
# Just run the test suites in current environment
${wrapper} rm -f nova.sqlite
${wrapper} $NOSETESTS 2> run_tests.err.log
}
NOSETESTS="python run_tests.py $noseargs" NOSETESTS="python run_tests.py $noseargs"
if [ $never_venv -eq 1 ]; then if [ $never_venv -eq 0 ]
# Just run the test suites in current environment then
rm -f nova.sqlite
$NOSETESTS 2> run_tests.err.log
exit
fi
# Remove the virtual environment if --force used # Remove the virtual environment if --force used
if [ $force -eq 1 ]; then if [ $force -eq 1 ]; then
echo "Cleaning virtualenv..." echo "Cleaning virtualenv..."
rm -rf ${venv} rm -rf ${venv}
fi fi
if [ -e ${venv} ]; then if [ -e ${venv} ]; then
${with_venv} rm -f nova.sqlite wrapper="${with_venv}"
${with_venv} $NOSETESTS 2> run_tests.err.log
else else
if [ $always_venv -eq 1 ]; then if [ $always_venv -eq 1 ]; then
# Automatically install the virtualenv # Automatically install the virtualenv
python tools/install_venv.py python tools/install_venv.py
wrapper="${with_venv}"
else else
echo -e "No virtual environment found...create one? (Y/n) \c" echo -e "No virtual environment found...create one? (Y/n) \c"
read use_ve read use_ve
if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
# Install the virtualenv and run the test suite in it # Install the virtualenv and run the test suite in it
python tools/install_venv.py python tools/install_venv.py
else wrapper=${with_venv}
rm -f nova.sqlite
$NOSETESTS 2> run_tests.err.log
exit
fi fi
fi fi
${with_venv} rm -f nova.sqlite
${with_venv} $NOSETESTS 2> run_tests.err.log
fi fi
fi
run_tests
pep8 --repeat --show-pep8 --show-source bin/* nova setup.py

View File

@ -41,6 +41,7 @@ class local_BuildDoc(BuildDoc):
self.finalize_options() self.finalize_options()
BuildDoc.run(self) BuildDoc.run(self)
class local_sdist(sdist): class local_sdist(sdist):
"""Customized sdist hook - builds the ChangeLog file from VC first""" """Customized sdist hook - builds the ChangeLog file from VC first"""