]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- changelog: Fixed issue in autogenerate type rendering where types that belong
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Jan 2015 16:26:36 +0000 (11:26 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Jan 2015 16:26:36 +0000 (11:26 -0500)
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

alembic/__init__.py
docs/build/changelog.rst
tests/test_autogen_render.py

index b834521c769b5f2a5e34e9a5da1b00ba20fc5b6c..d60038118800aa78105da4197086038f255d4906 100644 (file)
@@ -1,6 +1,6 @@
 from os import path
 
-__version__ = '0.7.3'
+__version__ = '0.7.4'
 
 package_dir = path.abspath(path.dirname(__file__))
 
index 5cf83d8bafaef0c19aee75859cc6e8f9b241ddc3..63567098686880466943bd4837a17e051858a1b8 100644 (file)
@@ -3,6 +3,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
index e020cec9e5a5426291ae45f6065114084db3abad..b3e8c4c40754f6ff5021b9e60143a99e981a92fb 100644 (file)
@@ -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,9 +893,29 @@ 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):