.. changelog::
:version: 0.8.7
+ .. change::
+ :tags: bug, autogenerate
+
+ Fixed bug in autogen where if the DB connection sends the default
+ schema as "None", this "None" would be removed from the list of
+ schemas to check if include_schemas were set. This could possibly
+ impact using include_schemas with SQLite.
+
.. change::
:tags: bug, batch
from alembic.testing import TestBase
from alembic.testing import config
from alembic.testing import assert_raises_message
-from alembic.testing.mock import Mock
+from alembic.testing.mock import Mock, patch
from alembic.testing import eq_, is_, is_not_
from alembic.util import CommandError
from ._autogen_fixtures import AutogenTest, AutogenFixtureTest
eq_(diffs[0][1].c.keys(), ['x'])
+class AutogenDefaultSchemaIsNoneTest(AutogenFixtureTest, TestBase):
+ __only_on__ = 'sqlite'
+
+ def setUp(self):
+ super(AutogenDefaultSchemaIsNoneTest, self).setUp()
+
+ # prerequisite
+ eq_(self.bind.dialect.default_schema_name, None)
+
+ def test_no_default_schema(self):
+
+ m1 = MetaData()
+ m2 = MetaData()
+
+ Table('a', m1, Column('x', String(50)))
+ Table('a', m2, Column('x', String(50)))
+
+ def _include_object(obj, name, type_, reflected, compare_to):
+ if type_ == "table":
+ return name in 'a' and obj.schema != 'main'
+ else:
+ return True
+
+ diffs = self._fixture(
+ m1, m2, include_schemas=True,
+ object_filters=_include_object)
+ eq_(len(diffs), 0)
+
+
class ModelOne(object):
__requires__ = ('unique_constraint_reflection', )