summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-01-09 11:26:36 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-01-09 11:26:36 -0500
commitfe54b591448fd91f26528fd3f8394dc6a42eaea9 (patch)
tree39c5b60575d4191b963fb05f8ac06190b3f6410c
parent758d52eb444b02ccb7987b4cb124b759cdedde74 (diff)
downloadalembic-fe54b591448fd91f26528fd3f8394dc6a42eaea9.tar.gz
- changelog: Fixed issue in autogenerate type rendering where types that belong
to modules that have the name "sqlalchemy" in them would be mistaken as being part of the ``sqlalchemy.`` namespace. Pull req courtesy Bartosz Burclaf. fixes #261
-rw-r--r--alembic/__init__.py2
-rw-r--r--docs/build/changelog.rst13
-rw-r--r--tests/test_autogen_render.py25
3 files changed, 37 insertions, 3 deletions
diff --git a/alembic/__init__.py b/alembic/__init__.py
index b834521..d600381 100644
--- a/alembic/__init__.py
+++ b/alembic/__init__.py
@@ -1,6 +1,6 @@
from os import path
-__version__ = '0.7.3'
+__version__ = '0.7.4'
package_dir = path.abspath(path.dirname(__file__))
diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst
index 5cf83d8..6356709 100644
--- a/docs/build/changelog.rst
+++ b/docs/build/changelog.rst
@@ -4,6 +4,19 @@
Changelog
==========
.. changelog::
+ :version: 0.7.4
+
+ .. change::
+ :tags: bug, autogenerate
+ :tickets: 261
+ :pullreq: github:17
+
+ Fixed issue in autogenerate type rendering where types that belong
+ to modules that have the name "sqlalchemy" in them would be mistaken
+ as being part of the ``sqlalchemy.`` namespace. Pull req courtesy
+ Bartosz Burclaf.
+
+.. changelog::
:version: 0.7.3
:released: December 30, 2014
diff --git a/tests/test_autogen_render.py b/tests/test_autogen_render.py
index e020cec..b3e8c4c 100644
--- a/tests/test_autogen_render.py
+++ b/tests/test_autogen_render.py
@@ -9,6 +9,7 @@ from sqlalchemy import MetaData, Column, Table, String, \
PrimaryKeyConstraint, Index, func, text, DefaultClause
from sqlalchemy.types import TIMESTAMP
+from sqlalchemy.types import UserDefinedType
from sqlalchemy.dialects import mysql, postgresql
from sqlalchemy.engine.default import DefaultDialect
from sqlalchemy.sql import and_, column, literal_column, false
@@ -892,10 +893,30 @@ unique=False, """
"sa.Integer()"
)
- def test_repr_user_type_user_prefix_None(self):
- from sqlalchemy.types import UserDefinedType
+ def test_repr_custom_type_w_sqla_prefix(self):
+ autogen_context = {
+ 'opts': {
+ 'sqlalchemy_module_prefix': 'sa.',
+ 'alembic_module_prefix': 'op.',
+ 'user_module_prefix': None
+ },
+ 'dialect': mysql.dialect()
+ }
class MyType(UserDefinedType):
+ pass
+
+ MyType.__module__ = "sqlalchemy_util.types"
+
+ type_ = MyType()
+
+ eq_ignore_whitespace(
+ autogenerate.render._repr_type(type_, autogen_context),
+ "sqlalchemy_util.types.MyType()"
+ )
+
+ def test_repr_user_type_user_prefix_None(self):
+ class MyType(UserDefinedType):
def get_col_spec(self):
return "MYTYPE"