summaryrefslogtreecommitdiff
path: root/tests/test_op.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-14 11:37:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-14 11:37:50 -0400
commit10ad109bb665a714dff27fd68f06c1b495a7169d (patch)
treeb6bd222c082a2468c5c26a8dbd59787f537ef897 /tests/test_op.py
parent10e9b2e1eab69bbfc249562994b951b3dc191bb8 (diff)
downloadalembic-10ad109bb665a714dff27fd68f06c1b495a7169d.tar.gz
- move pretty much all of sqlalchemy.testing over for now, as we'd
like to run tests against 0.8 and even late 0.7 versions with the same capabilities, as well as run parallel testing against all of them. we need a consistent system to get that all to work, so for now we have the whole SQLA system shoved into here, not ideal but we have a very good testing situation for now. Once we target 0.9.4 at the lowest we should be able to move all this out. - re-support 0.7, starting at 0.7.6 which is where things mostly work. All tests, taking into account known skips and fails which are added here for 0.7, early 0.8s, pass on 0.7.9.
Diffstat (limited to 'tests/test_op.py')
-rw-r--r--tests/test_op.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/tests/test_op.py b/tests/test_op.py
index 58e1cb3..13e58bd 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -10,6 +10,7 @@ from alembic.testing.fixtures import op_fixture
from alembic.testing import eq_, assert_raises_message
from alembic.testing import mock
from alembic.testing.fixtures import TestBase
+from alembic.testing import config
@event.listens_for(Table, "after_parent_attach")
@@ -57,6 +58,7 @@ class OpTest(TestBase):
context.assert_(
'CREATE INDEX geocoded ON locations ("IShouldBeQuoted")')
+ @config.requirements.fail_before_sqla_080
def test_create_index_expressions(self):
context = op_fixture()
op.create_index(
@@ -66,6 +68,7 @@ class OpTest(TestBase):
context.assert_(
"CREATE INDEX geocoded ON locations (lower(coordinates))")
+ @config.requirements.fail_before_sqla_080
def test_create_index_postgresql_expressions(self):
context = op_fixture("postgresql")
op.create_index(
@@ -459,6 +462,7 @@ class OpTest(TestBase):
"REFERENCES t2 (bat, hoho) INITIALLY INITIAL"
)
+ @config.requirements.foreign_key_match
def test_add_foreign_key_match(self):
context = op_fixture()
op.create_foreign_key('fk_test', 't1', 't2',
@@ -470,17 +474,24 @@ class OpTest(TestBase):
)
def test_add_foreign_key_dialect_kw(self):
- context = op_fixture()
+ op_fixture()
with mock.patch(
"alembic.operations.sa_schema.ForeignKeyConstraint") as fkc:
op.create_foreign_key('fk_test', 't1', 't2',
['foo', 'bar'], ['bat', 'hoho'],
foobar_arg='xyz')
- eq_(fkc.mock_calls[0],
- mock.call(['foo', 'bar'], ['t2.bat', 't2.hoho'],
- onupdate=None, ondelete=None, name='fk_test',
- foobar_arg='xyz',
- deferrable=None, initially=None, match=None))
+ if config.requirements.foreign_key_match.enabled:
+ eq_(fkc.mock_calls[0],
+ mock.call(['foo', 'bar'], ['t2.bat', 't2.hoho'],
+ onupdate=None, ondelete=None, name='fk_test',
+ foobar_arg='xyz',
+ deferrable=None, initially=None, match=None))
+ else:
+ eq_(fkc.mock_calls[0],
+ mock.call(['foo', 'bar'], ['t2.bat', 't2.hoho'],
+ onupdate=None, ondelete=None, name='fk_test',
+ foobar_arg='xyz',
+ deferrable=None, initially=None))
def test_add_foreign_key_self_referential(self):
context = op_fixture()
@@ -723,10 +734,6 @@ class OpTest(TestBase):
op.alter_column("t", "c", new_column_name="x")
context.assert_("ALTER TABLE t RENAME c TO x")
- context = op_fixture('mssql')
- op.drop_index('ik_test', tablename='t1')
- context.assert_("DROP INDEX ik_test ON t1")
-
context = op_fixture('mysql')
op.drop_constraint("f1", "t1", type="foreignkey")
context.assert_("ALTER TABLE t1 DROP FOREIGN KEY f1")
@@ -740,3 +747,9 @@ class OpTest(TestBase):
r"Unknown arguments: badarg\d, badarg\d",
op.alter_column, "t", "c", badarg1="x", badarg2="y"
)
+
+ @config.requirements.fail_before_sqla_084
+ def test_naming_changes_drop_idx(self):
+ context = op_fixture('mssql')
+ op.drop_index('ik_test', tablename='t1')
+ context.assert_("DROP INDEX ik_test ON t1")