Allow someone to set the GLANCE_TEST_MIGRATIONS_CONF environment

variable to override the config file to run for the migrations
unit test:

pipes@serialcoder:~/repos/glance/bug730213$ GLANCE_TEST_MIGRATIONS_CONF=/tmp/glance_test_migrations.conf ./run_tests.sh -V tests.unit.test_migrations
TestMigrations
    test_no_data_loss_2_to_3_to_2                               OK
        test_walk_versions                                          OK

        ----------------------------------------------------------------------
        Ran 2 tests in 2.744s

This will make Monty happy so that Hudson can test more than just SQLite...
This commit is contained in:
jaypipes@gmail.com 2011-03-24 15:31:30 -04:00
parent c8d5756e9d
commit 3716d83995
2 changed files with 6 additions and 3 deletions

View File

@ -2,4 +2,4 @@
# Set up any number of migration data stores you want, one
# The "name" used in the test is the config variable key.
sqlite=sqlite:///test_migrations.db
mysql=mysql://root:@localhost/test_migrations
#mysql=mysql://root:@localhost/test_migrations

View File

@ -44,8 +44,11 @@ class TestMigrations(unittest.TestCase):
"""Test sqlalchemy-migrate migrations"""
TEST_DATABASES = {}
CONFIG_FILE_PATH = os.path.join('tests', 'unit',
'test_migrations.conf')
# Test machines can set the GLANCE_TEST_MIGRATIONS_CONF variable
# to override the location of the config file for migration testing
CONFIG_FILE_PATH = os.environ.get('GLANCE_TEST_MIGRATIONS_CONF',
os.path.join('tests', 'unit',
'test_migrations.conf'))
REPOSITORY_PATH = os.path.join('glance', 'registry', 'db', 'migrate_repo')
REPOSITORY = Repository(REPOSITORY_PATH)