- [bug] Fixed the regexp that was checking for .py files

in the version directory to allow any .py file through.
  Previously it was doing some kind of defensive checking,
  probably from some early notions of how this directory
  works, that was prohibiting various filename patterns
  such as those which begin with numbers.  #72
This commit is contained in:
Mike Bayer
2012-09-30 12:37:02 -04:00
parent 35ef4896bf
commit b3f20c640a
3 changed files with 20 additions and 12 deletions

View File

@@ -5,6 +5,13 @@
front-ends can re-use the argument parsing built
in. #70
- [bug] Fixed the regexp that was checking for .py files
in the version directory to allow any .py file through.
Previously it was doing some kind of defensive checking,
probably from some early notions of how this directory
works, that was prohibiting various filename patterns
such as those which begin with numbers. #72
- [bug] Fixed MySQL rendering for server_default which
didn't work if the server_default was a generated
SQL expression. Courtesy Moriyoshi Koizumi.

View File

@@ -4,10 +4,9 @@ import os
from alembic import util
import shutil
import re
import inspect
import datetime
_rev_file = re.compile(r'([a-z0-9A-Z]+)(?:_.*)?\.py$')
_rev_file = re.compile(r'.*\.py$')
_legacy_rev = re.compile(r'([a-f0-9]+)\.py$')
_mod_def_re = re.compile(r'(upgrade|downgrade)_([a-z0-9]+)')
_slug_re = re.compile(r'\w+')
@@ -418,8 +417,7 @@ class Script(object):
@classmethod
def _from_filename(cls, dir_, filename):
m = _rev_file.match(filename)
if not m:
if not _rev_file.match(filename):
return None
module = util.load_python_file(dir_, filename)
if not hasattr(module, "revision"):

View File

@@ -70,12 +70,14 @@ class GeneralOrderedTests(unittest.TestCase):
def test_008_long_name(self):
rid = util.rev_id()
script = env.generate_revision(rid,
env.generate_revision(rid,
"this is a really long name with "
"lots of characters and also "
"I'd like it to\nhave\nnewlines")
assert os.access(
os.path.join(env.dir, 'versions', '%s_this_is_a_really_lon.py' % rid), os.F_OK)
os.path.join(env.dir, 'versions',
'%s_this_is_a_really_lon.py' % rid), os.F_OK)
@classmethod
def setup_class(cls):
@@ -110,9 +112,10 @@ class ScriptNamingTest(unittest.TestCase):
"message_2012_5_25_15_5_5.py" % staging_directory
)
class TemplateArgsTest(unittest.TestCase):
def setUp(self):
env = staging_env()
staging_env()
self.cfg = _no_sql_testing_config(
directives="\nrevision_environment=true\n"
)
@@ -123,17 +126,17 @@ class TemplateArgsTest(unittest.TestCase):
def test_args_propagate(self):
config = _no_sql_testing_config()
script = ScriptDirectory.from_config(config)
template_args = {"x":"x1", "y":"y1", "z":"z1"}
template_args = {"x": "x1", "y": "y1", "z": "z1"}
env = EnvironmentContext(
config,
script,
template_args = template_args
template_args=template_args
)
mig_env = env.configure(dialect_name="sqlite",
template_args={"y":"y2", "q":"q1"})
env.configure(dialect_name="sqlite",
template_args={"y": "y2", "q": "q1"})
eq_(
template_args,
{"x":"x1", "y":"y2", "z":"z1", "q":"q1"}
{"x": "x1", "y": "y2", "z": "z1", "q": "q1"}
)
def test_tmpl_args_revision(self):