Skip to content

Commit

Permalink
Skip test if sqlite3 not installed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Andrew Laski committed Sep 27, 2013
1 parent ab5a99b commit e9704d0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nova/tests/db/test_sqlite.py
Expand Up @@ -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
Expand Down Expand Up @@ -48,7 +49,15 @@ class User(base_class):
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")

Expand Down

0 comments on commit e9704d0

Please sign in to comment.