summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-11-25 10:31:20 -0500
committerFederico Caselli <cfederico87@gmail.com>2023-05-11 22:24:53 +0200
commitdf75e85489b9ae69fffff2c5ad2594b30bed2fd4 (patch)
tree1669378a851faf81724f3d5e83ab63814cb43e3f /tests
parent92e54a0e1c96cecd99397cb1aee9c3bb28f780c6 (diff)
downloadalembic-df75e85489b9ae69fffff2c5ad2594b30bed2fd4.tar.gz
keyword only arguments in ops
Argument signatures of Alembic operations now enforce keyword-only arguments as passed as keyword and not positionally, such as :paramref:`.Operations.create_table.schema`, :paramref:`.Operations.add_column.type_`, etc. Change-Id: I91b453c8848dc5d24d63840bfd7ce4d22dd0e693 Fixes: #1130
Diffstat (limited to 'tests')
-rw-r--r--tests/test_batch.py2
-rw-r--r--tests/test_mssql.py2
-rw-r--r--tests/test_mysql.py18
-rw-r--r--tests/test_oracle.py2
-rw-r--r--tests/test_postgresql.py12
5 files changed, 22 insertions, 14 deletions
diff --git a/tests/test_batch.py b/tests/test_batch.py
index 52f9baf..66d59fd 100644
--- a/tests/test_batch.py
+++ b/tests/test_batch.py
@@ -1778,7 +1778,7 @@ class BatchRoundTripTest(TestBase):
with self.op.batch_alter_table(
"ck_table", recreate=recreate
) as batch_op:
- batch_op.drop_constraint("ck", "check")
+ batch_op.drop_constraint("ck", type_="check")
ck_consts = inspect(self.conn).get_check_constraints("ck_table")
eq_(ck_consts, [])
diff --git a/tests/test_mssql.py b/tests/test_mssql.py
index 640e168..b785e2f 100644
--- a/tests/test_mssql.py
+++ b/tests/test_mssql.py
@@ -158,7 +158,7 @@ class OpTest(TestBase):
def test_drop_index(self):
context = op_fixture("mssql")
- op.drop_index("my_idx", "my_table")
+ op.drop_index("my_idx", table_name="my_table")
context.assert_contains("DROP INDEX my_idx ON my_table")
def test_drop_column_w_default(self):
diff --git a/tests/test_mysql.py b/tests/test_mysql.py
index 92c1819..fd3b185 100644
--- a/tests/test_mysql.py
+++ b/tests/test_mysql.py
@@ -396,12 +396,12 @@ class MySQLOpTest(TestBase):
def test_drop_fk(self):
context = op_fixture("mysql")
- op.drop_constraint("f1", "t1", "foreignkey")
+ op.drop_constraint("f1", "t1", type_="foreignkey")
context.assert_("ALTER TABLE t1 DROP FOREIGN KEY f1")
def test_drop_fk_quoted(self):
context = op_fixture("mysql")
- op.drop_constraint("MyFk", "MyTable", "foreignkey")
+ op.drop_constraint("MyFk", "MyTable", type_="foreignkey")
context.assert_("ALTER TABLE `MyTable` DROP FOREIGN KEY `MyFk`")
def test_drop_constraint_primary(self):
@@ -411,32 +411,32 @@ class MySQLOpTest(TestBase):
def test_drop_unique(self):
context = op_fixture("mysql")
- op.drop_constraint("f1", "t1", "unique")
+ op.drop_constraint("f1", "t1", type_="unique")
context.assert_("ALTER TABLE t1 DROP INDEX f1")
def test_drop_unique_quoted(self):
context = op_fixture("mysql")
- op.drop_constraint("MyUnique", "MyTable", "unique")
+ op.drop_constraint("MyUnique", "MyTable", type_="unique")
context.assert_("ALTER TABLE `MyTable` DROP INDEX `MyUnique`")
def test_drop_check_mariadb(self):
context = op_fixture("mariadb")
- op.drop_constraint("f1", "t1", "check")
+ op.drop_constraint("f1", "t1", type_="check")
context.assert_("ALTER TABLE t1 DROP CONSTRAINT f1")
def test_drop_check_quoted_mariadb(self):
context = op_fixture("mariadb")
- op.drop_constraint("MyCheck", "MyTable", "check")
+ op.drop_constraint("MyCheck", "MyTable", type_="check")
context.assert_("ALTER TABLE `MyTable` DROP CONSTRAINT `MyCheck`")
def test_drop_check_mysql(self):
context = op_fixture("mysql")
- op.drop_constraint("f1", "t1", "check")
+ op.drop_constraint("f1", "t1", type_="check")
context.assert_("ALTER TABLE t1 DROP CHECK f1")
def test_drop_check_quoted_mysql(self):
context = op_fixture("mysql")
- op.drop_constraint("MyCheck", "MyTable", "check")
+ op.drop_constraint("MyCheck", "MyTable", type_="check")
context.assert_("ALTER TABLE `MyTable` DROP CHECK `MyCheck`")
def test_drop_unknown(self):
@@ -448,7 +448,7 @@ class MySQLOpTest(TestBase):
op.drop_constraint,
"f1",
"t1",
- "typo",
+ type_="typo",
)
def test_drop_generic_constraint(self):
diff --git a/tests/test_oracle.py b/tests/test_oracle.py
index f84c0e1..63ac1c4 100644
--- a/tests/test_oracle.py
+++ b/tests/test_oracle.py
@@ -163,7 +163,7 @@ class OpTest(TestBase):
def test_drop_index(self):
context = op_fixture("oracle")
- op.drop_index("my_idx", "my_table")
+ op.drop_index("my_idx", table_name="my_table")
context.assert_contains("DROP INDEX my_idx")
def test_drop_column_w_default(self):
diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py
index 77ed4da..4d17096 100644
--- a/tests/test_postgresql.py
+++ b/tests/test_postgresql.py
@@ -122,9 +122,17 @@ class PostgresqlOpTest(TestBase):
op.create_index("i", "t", ["c1", "c2"], unique=False)
context.assert_("CREATE INDEX i ON t (c1, c2)")
- def test_drop_index_postgresql_concurrently(self):
+ @config.combinations("include_table", "no_table", argnames="include_table")
+ def test_drop_index_postgresql_concurrently(self, include_table):
context = op_fixture("postgresql")
- op.drop_index("geocoded", "locations", postgresql_concurrently=True)
+ if include_table == "include_table":
+ op.drop_index(
+ "geocoded",
+ table_name="locations",
+ postgresql_concurrently=True,
+ )
+ else:
+ op.drop_index("geocoded", postgresql_concurrently=True)
context.assert_("DROP INDEX CONCURRENTLY geocoded")
def test_alter_column_type_using(self):