From f88b15a5263e1e09870161d5be33508907472cae Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 22 Dec 2015 12:33:03 -0800 Subject: [PATCH] Fix currently broken and inactive mysql tests Commit 868dd8485456ce78a396b687ec7744dc365f06be added a migration script that caused there to be two heads (starting points) of migrations which would cause alembic to be unable to do the initial schema creation (and upgrade). So this fixes that by correctly making one head only and not skipping tests for a database if it can not be upgraded for whatever reason (which was silencing the test failures). Closes-bug: #1528683 Change-Id: Id571072eec1dc3b6cbb9e868854f6db0b271e5f8 --- .../versions/2ad4984f2864_switch_postgres_to_json_native.py | 4 ++-- taskflow/tests/unit/persistence/test_sql_persistence.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py b/taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py index e795dfce..c539ff18 100644 --- a/taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py +++ b/taskflow/persistence/backends/sqlalchemy/alembic/versions/2ad4984f2864_switch_postgres_to_json_native.py @@ -17,14 +17,14 @@ """Switch postgres to json native type. Revision ID: 2ad4984f2864 -Revises: 589dccdf2b6e +Revises: 3162c0f3f8e4 Create Date: 2015-06-04 13:08:36.667948 """ # revision identifiers, used by Alembic. revision = '2ad4984f2864' -down_revision = '589dccdf2b6e' +down_revision = '3162c0f3f8e4' from alembic import op diff --git a/taskflow/tests/unit/persistence/test_sql_persistence.py b/taskflow/tests/unit/persistence/test_sql_persistence.py index 8a8e22c1..973bf9f7 100644 --- a/taskflow/tests/unit/persistence/test_sql_persistence.py +++ b/taskflow/tests/unit/persistence/test_sql_persistence.py @@ -160,14 +160,11 @@ class BackendPersistenceTestMixin(base.PersistenceTestMixin): except Exception as e: self.skipTest("Failed to create temporary database;" " testing being skipped due to: %s" % (e)) - try: + else: self.backend = impl_sqlalchemy.SQLAlchemyBackend(self.db_conf) self.addCleanup(self.backend.close) with contextlib.closing(self._get_connection()) as conn: conn.upgrade() - except Exception as e: - self.skipTest("Failed to setup your database;" - " testing being skipped due to: %s" % (e)) @testtools.skipIf(not _mysql_exists(), 'mysql is not available')