Skip to content

Commit

Permalink
- changelog: Fixed issue in autogenerate type rendering where types t…
Browse files Browse the repository at this point in the history
…hat 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
  • Loading branch information
zzzeek committed Jan 9, 2015
1 parent 758d52e commit fe54b59
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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__))

Expand Down
13 changes: 13 additions & 0 deletions docs/build/changelog.rst
Expand Up @@ -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
Expand Down
25 changes: 23 additions & 2 deletions tests/test_autogen_render.py
Expand Up @@ -9,6 +9,7 @@
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
Expand Down Expand Up @@ -892,9 +893,29 @@ def test_repr_plain_sqla_type(self):
"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):
Expand Down

0 comments on commit fe54b59

Please sign in to comment.