summaryrefslogtreecommitdiff
path: root/tests/sqlalchemy/test_utils.py
diff options
context:
space:
mode:
authorIlya Pekelny <ipekelny@mirantis.com>2014-05-13 14:40:47 +0300
committerIlya Pekelny <ipekelny@mirantis.com>2014-05-29 18:21:40 +0300
commit89833d8278e753d6a19645268c1b4181163b9c06 (patch)
tree26c55036aa7f4f88121c0f658d040d3f6d86fc83 /tests/sqlalchemy/test_utils.py
parentae8e3ef410fdc32efa92d6ae5399a55353b5931a (diff)
downloadoslo-db-89833d8278e753d6a19645268c1b4181163b9c06.tar.gz
Fix the test using in-file SQLite database
SQLite in-file uses exclusively lock for database, so the connection must be only one. Change-Id: I9aad455d1466e4b17579253af47bf1b7e51dbc49 Closes-Bug: #1308032
Diffstat (limited to 'tests/sqlalchemy/test_utils.py')
-rw-r--r--tests/sqlalchemy/test_utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/sqlalchemy/test_utils.py b/tests/sqlalchemy/test_utils.py
index d1b82d8..30ffd45 100644
--- a/tests/sqlalchemy/test_utils.py
+++ b/tests/sqlalchemy/test_utils.py
@@ -239,6 +239,18 @@ class TestMigrationUtils(test_migrations.BaseMigrationTestCase):
for id_ in expected_ids:
self.assertTrue(id_ in real_ids)
+ def test_drop_dup_entries_in_file_conn(self):
+ table_name = "__test_tmp_table__"
+ tmp_db_file = self.create_tempfiles([['name', '']], ext='.sql')[0]
+ in_file_engine = session.EngineFacade(
+ 'sqlite:///%s' % tmp_db_file).get_engine()
+ meta = MetaData()
+ meta.bind = in_file_engine
+ test_table, values = self._populate_db_for_drop_duplicate_entries(
+ in_file_engine, meta, table_name)
+ utils.drop_old_duplicate_entries_from_table(
+ in_file_engine, table_name, False, 'b', 'c')
+
def test_drop_old_duplicate_entries_from_table_soft_delete(self):
table_name = "__test_tmp_table__"