diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-04-27 22:22:40 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-04-27 22:22:40 -0400 |
commit | aad081fbf70b424ca1a3dcf6b1bf148048799f05 (patch) | |
tree | 7749c262dddef1762175ac04a65b98c3e942d11f /tests/__init__.py | |
parent | 46695c8111e8a1f4f4c1aa4abdb14ed29ae7829b (diff) | |
download | alembic-aad081fbf70b424ca1a3dcf6b1bf148048799f05.tar.gz |
full round of revision file tests
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index c889154..ee5eb28 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -5,7 +5,7 @@ import shutil import os import itertools -testing_directory = os.path.join(os.path.dirname(__file__), 'scratch') +staging_directory = os.path.join(os.path.dirname(__file__), 'scratch') _dialects = defaultdict(lambda name:url.URL(drivername).get_dialect()()) def _get_dialect(name): @@ -19,26 +19,27 @@ def assert_compiled(element, assert_string, dialect=None): dialect = _get_dialect(dialect) eq_(unicode(element.compile(dialect=dialect)), assert_string) - def _testing_options(**kw): from alembic.options import Options, get_option_parser - os.mkdir(testing_directory) + if not os.access(staging_directory, os.F_OK): + os.mkdir(staging_directory) kw.setdefault( 'config', - os.path.join(testing_directory, 'test_alembic.ini') + os.path.join(staging_directory, 'test_alembic.ini') ) return Options( get_option_parser(), list(itertools.chain(*[["--%s" % k, "%r" % v] for k, v in kw.items()]) ) - + [os.path.join(testing_directory, 'scripts')] + + [os.path.join(staging_directory, 'scripts')] ) -def _testing_env(): +def staging_env(create=True): from alembic import command, script opt = _testing_options() - command.init(opt) + if create: + command.init(opt) return script.ScriptDirectory.from_options(opt) -def _clear_testing_directory(): - shutil.rmtree(testing_directory, True) +def clear_staging_env(): + shutil.rmtree(staging_directory, True)
\ No newline at end of file |