only create the db if it doesn't exist, add an option -r to run_tests.py to delete it
This commit is contained in:
parent
8a8c013cd4
commit
9978d656d2
@ -50,7 +50,7 @@ def setup():
|
|||||||
|
|
||||||
testdb = os.path.join(FLAGS.state_path, FLAGS.sqlite_db)
|
testdb = os.path.join(FLAGS.state_path, FLAGS.sqlite_db)
|
||||||
if os.path.exists(testdb):
|
if os.path.exists(testdb):
|
||||||
os.unlink(testdb)
|
return
|
||||||
migration.db_sync()
|
migration.db_sync()
|
||||||
ctxt = context.get_admin_context()
|
ctxt = context.get_admin_context()
|
||||||
network_manager.VlanManager().create_networks(ctxt,
|
network_manager.VlanManager().create_networks(ctxt,
|
||||||
|
@ -69,7 +69,6 @@ from nose import core
|
|||||||
from nose import result
|
from nose import result
|
||||||
|
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
from nova.tests import fake_flags
|
|
||||||
|
|
||||||
|
|
||||||
class _AnsiColorizer(object):
|
class _AnsiColorizer(object):
|
||||||
|
@ -6,6 +6,7 @@ function usage {
|
|||||||
echo ""
|
echo ""
|
||||||
echo " -V, --virtual-env Always use virtualenv. Install automatically if not present"
|
echo " -V, --virtual-env Always use virtualenv. Install automatically if not present"
|
||||||
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
|
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
|
||||||
|
echo " -r, --recreate-db Recreate the test database."
|
||||||
echo " -x, --stop Stop running tests after the first error or failure."
|
echo " -x, --stop Stop running tests after the first error or failure."
|
||||||
echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
|
echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
|
||||||
echo " -p, --pep8 Just run pep8"
|
echo " -p, --pep8 Just run pep8"
|
||||||
@ -23,6 +24,7 @@ function process_option {
|
|||||||
-h|--help) usage;;
|
-h|--help) usage;;
|
||||||
-V|--virtual-env) let always_venv=1; let never_venv=0;;
|
-V|--virtual-env) let always_venv=1; let never_venv=0;;
|
||||||
-N|--no-virtual-env) let always_venv=0; let never_venv=1;;
|
-N|--no-virtual-env) let always_venv=0; let never_venv=1;;
|
||||||
|
-r|--recreate-db) let recreate_db=1;;
|
||||||
-f|--force) let force=1;;
|
-f|--force) let force=1;;
|
||||||
-p|--pep8) let just_pep8=1;;
|
-p|--pep8) let just_pep8=1;;
|
||||||
-*) noseopts="$noseopts $1";;
|
-*) noseopts="$noseopts $1";;
|
||||||
@ -39,6 +41,7 @@ noseargs=
|
|||||||
noseopts=
|
noseopts=
|
||||||
wrapper=""
|
wrapper=""
|
||||||
just_pep8=0
|
just_pep8=0
|
||||||
|
recreate_db=0
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
process_option $arg
|
process_option $arg
|
||||||
@ -108,6 +111,10 @@ if [ $just_pep8 -eq 1 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $recreate_db -eq 1 ]; then
|
||||||
|
rm tests.sqlite
|
||||||
|
fi
|
||||||
|
|
||||||
run_tests || exit
|
run_tests || exit
|
||||||
|
|
||||||
# NOTE(sirp): we only want to run pep8 when we're running the full-test suite,
|
# NOTE(sirp): we only want to run pep8 when we're running the full-test suite,
|
||||||
|
Loading…
Reference in New Issue
Block a user