From e9704d0f019be530d5952844feecaf0ed4e31914 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Thu, 19 Sep 2013 16:24:15 -0400 Subject: [PATCH] Skip test if sqlite3 not installed The test is attempting to run the sqlite3 binary during its test run. Since there's no guarantee that it's installed it should catch an execution error and skip. Change-Id: I9f4ed1872fcfe3b8393644a77692dbfcce8ecab2 Closes-bug: 1227868 --- nova/tests/db/test_sqlite.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nova/tests/db/test_sqlite.py b/nova/tests/db/test_sqlite.py index 672ee533055e..fa9d1134ebf9 100644 --- a/nova/tests/db/test_sqlite.py +++ b/nova/tests/db/test_sqlite.py @@ -19,6 +19,7 @@ """Test cases for sqlite-specific logic""" +from nova.openstack.common import processutils from nova import test from nova import utils import os @@ -48,7 +49,15 @@ class TestSqlite(test.NoDBTestCase): get_schema_cmd = "sqlite3 %s '.schema'" % self.db_file engine = create_engine("sqlite:///%s" % self.db_file) base_class.metadata.create_all(engine) - output, _ = utils.execute(get_schema_cmd, shell=True) + try: + output, _ = utils.execute(get_schema_cmd, shell=True) + except processutils.ProcessExecutionError as e: + # NOTE(alaski): If this check becomes necessary in other tests it + # should be moved into setUp. + if 'not found' in str(e): + self.skipTest(str(e)) + else: + raise self.assertFalse('BIGINT' in output, msg="column type BIGINT " "not converted to INTEGER in schema")