diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-02 14:42:09 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-02 14:42:09 -0400 |
commit | d4094ff7a76cd4438b15242c7c883333235fc0c7 (patch) | |
tree | c525786539ff6fdedce66aad1c5eff05e768bf72 /tests/__init__.py | |
parent | bb160dbf30440144d002810ebd5c5520e37562d7 (diff) | |
download | alembic-d4094ff7a76cd4438b15242c7c883333235fc0c7.tar.gz |
- [feature] New config argumentrel_0_3_3
"revision_environment=true", causes env.py to
be run unconditionally when the "revision" command
is run, to support script.py.mako templates with
dependencies on custom "template_args".
- [feature] Added "template_args" option to configure()
so that an env.py can add additional arguments
to the template context when running the
"revision" command. This requires either --autogenerate
or the configuration directive "revision_environment=true".
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 7f83300..3d9455b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -181,6 +181,12 @@ def op_fixture(dialect='default', as_sql=False): alembic.op._proxy = Operations(context) return context +def script_file_fixture(txt): + dir_ = os.path.join(staging_directory, 'scripts') + path = os.path.join(dir_, "script.py.mako") + with open(path, 'w') as f: + f.write(txt) + def env_file_fixture(txt): dir_ = os.path.join(staging_directory, 'scripts') txt = """ @@ -230,13 +236,14 @@ datefmt = %%H:%%M:%%S """ % (dir_, dir_)) -def _no_sql_testing_config(dialect="postgresql"): +def _no_sql_testing_config(dialect="postgresql", directives=""): """use a postgresql url with no host so that connections guaranteed to fail""" dir_ = os.path.join(staging_directory, 'scripts') return _write_config_file(""" [alembic] script_location = %s sqlalchemy.url = %s:// +%s [loggers] keys = root @@ -262,7 +269,7 @@ keys = generic format = %%(levelname)-5.5s [%%(name)s] %%(message)s datefmt = %%H:%%M:%%S -""" % (dir_, dialect)) +""" % (dir_, dialect, directives)) def _write_config_file(text): cfg = _testing_config() |