From 002fd244f13d42b9edc6d735f079c620472e0512 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 3 Aug 2012 13:07:47 -0400 Subject: [PATCH] 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 --- nova/tests/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py index a8d0ef28c..e438e1d64 100644 --- a/nova/tests/__init__.py +++ b/nova/tests/__init__.py @@ -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))