Update reset_db to call setup if _DB is None.

This resolves issues when running individual tests that require
a database. With this fix I can once again run individual test
modules that make use of the database. For example:

  ./run_tests.sh test_libvirt

Previously this would fail with database errors.

Fixes LP Bug #1032738.

Change-Id: Icce7ac9414f0e19eece44819a217634947de7f73
This commit is contained in:
Dan Prince 2012-08-03 13:07:47 -04:00
parent 44210bbb84
commit 002fd244f1

View File

@ -61,6 +61,8 @@ def reset_db():
conn = engine.connect()
if _DB:
conn.connection.executescript(_DB)
else:
setup()
else:
shutil.copyfile(os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db),
os.path.join(FLAGS.state_path, FLAGS.sqlite_db))