diff --git a/keystone/tests/unit/test_sql_upgrade.py b/keystone/tests/unit/test_sql_upgrade.py index 856be78c29..1fe1260ca4 100644 --- a/keystone/tests/unit/test_sql_upgrade.py +++ b/keystone/tests/unit/test_sql_upgrade.py @@ -36,6 +36,7 @@ import uuid import migrate from migrate.versioning import repository +from migrate.versioning import script import mock from oslo_db import exception as db_exception from oslo_db.sqlalchemy import test_base @@ -188,6 +189,11 @@ class SqlMigrateBase(test_base.DbTestCase): def setUp(self): super(SqlMigrateBase, self).setUp() + # NOTE(dstanek): Clear out sqlalchemy-migrate's script cache to allow + # us to have multiple repos (expand, migrate, contrate) where the + # modules have the same name (001_awesome.py). + self.addCleanup(script.PythonScript.clear) + # Set keystone's connection URL to be the test engine's url. database.initialize_sql_session(self.engine.url)