Skip to content

Instantly share code, notes, and snippets.

@asadoughi
Created May 29, 2014 18:14
Show Gist options
  • Save asadoughi/a07fc746a82ab800e820 to your computer and use it in GitHub Desktop.
Save asadoughi/a07fc746a82ab800e820 to your computer and use it in GitHub Desktop.
--- a/quark/tests/test_db_api.py
+++ b/quark/tests/test_db_api.py
@@ -19,6 +19,7 @@ from neutron.db import api as neutron_db_api
from oslo.config import cfg
from quark.db import api as db_api
+from quark.db import models
from quark.tests import test_base
@@ -31,7 +32,11 @@ class TestDBAPI(test_base.TestBase):
cfg.CONF.set_override('connection', 'sqlite://', 'database')
neutron_db_api.configure_db()
- configure_mappers()
+ neutron_db_api.register_models(models.BASEV2)
+
+ def tearDown(self):
+ neutron_db_api.unregister_models(models.BASEV2)
+ neutron_db_api.clear_db()
def test_port_find_ip_address_id(self):
self.context.session.query = mock.Mock()
@@ -52,13 +57,13 @@ class TestDBAPI(test_base.TestBase):
try:
db_api.ip_address_find(self.context, ip_address=ip_address,
scope=db_api.ONE)
- except Exception:
- self.fail("Expected no exceptions")
+ except Exception as e:
+ self.fail("Expected no exceptions: %s" % e)
def test_ip_address_find_ip_address_list(self):
ip_address = netaddr.IPAddress("192.168.10.1")
try:
db_api.ip_address_find(self.context, ip_address=[ip_address],
scope=db_api.ONE)
- except Exception:
- self.fail("Expected no exceptions")
+ except Exception as e:
+ self.fail("Expected no exceptions: %s" % e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment