diff options
author | CaselIT <cfederico87@gmail.com> | 2020-10-16 21:39:41 +0200 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-26 11:11:04 -0400 |
commit | a9f333021cf0c1c799e15d1b5a087bcea7c65231 (patch) | |
tree | c23b6ffb4a12dd4253b69148a3671ea1ce499830 /tests | |
parent | 322d8312d21b031b17044565b5e8cfc9ee7be141 (diff) | |
download | alembic-a9f333021cf0c1c799e15d1b5a087bcea7c65231.tar.gz |
Remove support for Python 3.5 and SQLAlchemy older than the 1.3 series.
Fixes: #748
Change-Id: I18df97bdce5de6adb222d3f16486272e95b1b1a6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/requirements.py | 49 | ||||
-rw-r--r-- | tests/test_autogen_render.py | 9 | ||||
-rw-r--r-- | tests/test_batch.py | 3 | ||||
-rw-r--r-- | tests/test_environment.py | 1 | ||||
-rw-r--r-- | tests/test_mysql.py | 14 | ||||
-rw-r--r-- | tests/test_oracle.py | 3 | ||||
-rw-r--r-- | tests/test_postgresql.py | 10 | ||||
-rw-r--r-- | tests/test_sqlite.py | 2 | ||||
-rw-r--r-- | tests/test_version_traversal.py | 4 |
9 files changed, 1 insertions, 94 deletions
diff --git a/tests/requirements.py b/tests/requirements.py index 4599013..eb6066d 100644 --- a/tests/requirements.py +++ b/tests/requirements.py @@ -218,36 +218,6 @@ class DefaultRequirements(SuiteRequirements): self._mysql_and_check_constraints_exist, ) - @property - def mysql_check_reflection_or_none(self): - # succeed if: - # 1. SQLAlchemy does not reflect CHECK constraints - # 2. SQLAlchemy does reflect CHECK constraints, but MySQL does not. - def go(config): - return ( - not self._mysql_check_constraints_exist(config) - or self.sqlalchemy_1115.enabled - ) - - return exclusions.succeeds_if(go) - - @property - def mysql_timestamp_reflection(self): - def go(config): - return ( - not self._mariadb_102(config) or self.sqlalchemy_1115.enabled - ) - - return exclusions.only_if(go) - - def _mariadb_102(self, config): - return ( - exclusions.against(config, ["mysql", "mariadb"]) - and sqla_compat._is_mariadb(config.db.dialect) - and sqla_compat._mariadb_normalized_version_info(config.db.dialect) - > (10, 2) - ) - def mysql_check_col_name_change(self, config): # MySQL has check constraints that enforce an reflect, however # they prevent a column's name from being changed due to a bug in @@ -281,22 +251,3 @@ class DefaultRequirements(SuiteRequirements): return norm_version_info >= (8, 0, 16) else: return False - - def _mysql_check_constraints_exist(self, config): - # 1. we dont have mysql / mariadb or - # 2. we have mysql / mariadb that enforces check constraints - return not exclusions.against( - config, ["mysql", "mariadb"] - ) or self._mysql_and_check_constraints_exist(config) - - def _mysql_check_constraints_dont_exist(self, config): - # 1. we have mysql / mariadb and - # 2. they dont enforce check constraints - return not self._mysql_check_constraints_exist(config) - - def _mysql_not_mariadb_102(self, config): - return exclusions.against(config, ["mysql", "mariadb"]) and ( - not sqla_compat._is_mariadb(config.db.dialect) - or sqla_compat._mariadb_normalized_version_info(config.db.dialect) - < (10, 2) - ) diff --git a/tests/test_autogen_render.py b/tests/test_autogen_render.py index d86e934..e7999f4 100644 --- a/tests/test_autogen_render.py +++ b/tests/test_autogen_render.py @@ -1168,7 +1168,6 @@ class AutogenRenderTest(TestBase): "nullable=False)", ) - @config.requirements.comments_api def test_render_col_with_comment(self): c = Column("some_key", Integer, comment="This is a comment") Table("some_table", MetaData(), c) @@ -1180,7 +1179,6 @@ class AutogenRenderTest(TestBase): "comment='This is a comment')", ) - @config.requirements.comments_api def test_render_col_comment_with_quote(self): c = Column("some_key", Integer, comment="This is a john's comment") Table("some_table", MetaData(), c) @@ -1865,7 +1863,6 @@ class AutogenRenderTest(TestBase): op_obj, ) - @config.requirements.comments_api def test_render_alter_column_modify_comment(self): op_obj = ops.AlterColumnOp( "sometable", "somecolumn", modify_comment="This is a comment" @@ -1876,7 +1873,6 @@ class AutogenRenderTest(TestBase): "comment='This is a comment')", ) - @config.requirements.comments_api def test_render_alter_column_existing_comment(self): op_obj = ops.AlterColumnOp( "sometable", "somecolumn", existing_comment="This is a comment" @@ -1887,7 +1883,6 @@ class AutogenRenderTest(TestBase): "existing_comment='This is a comment')", ) - @config.requirements.comments_api def test_render_col_drop_comment(self): op_obj = ops.AlterColumnOp( "sometable", @@ -1902,7 +1897,6 @@ class AutogenRenderTest(TestBase): "existing_comment='This is a comment')", ) - @config.requirements.comments_api def test_render_table_with_comment(self): m = MetaData() t = Table( @@ -1924,7 +1918,6 @@ class AutogenRenderTest(TestBase): ")", ) - @config.requirements.comments_api def test_render_add_column_with_comment(self): op_obj = ops.AddColumnOp( "foo", Column("x", Integer, comment="This is a Column") @@ -1935,7 +1928,6 @@ class AutogenRenderTest(TestBase): "nullable=True, comment='This is a Column'))", ) - @config.requirements.comments_api def test_render_create_table_comment_op(self): op_obj = ops.CreateTableCommentOp("table_name", "comment") eq_ignore_whitespace( @@ -1948,7 +1940,6 @@ class AutogenRenderTest(TestBase): ")", ) - @config.requirements.comments_api def test_render_create_table_comment_with_quote_op(self): op_obj = ops.CreateTableCommentOp( "table_name", diff --git a/tests/test_batch.py b/tests/test_batch.py index faff4f5..9501e32 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -1365,7 +1365,6 @@ class BatchRoundTripTest(TestBase): [(datetime.datetime(2012, 5, 18, 15, 32, 5),)], ) - @config.requirements.sqlalchemy_12 def test_no_net_change_timestamp_w_default(self): t = self._timestamp_w_expr_default_fixture() @@ -1932,11 +1931,9 @@ class BatchRoundTripMySQLTest(BatchRoundTripTest): def test_rename_column_boolean(self): super(BatchRoundTripMySQLTest, self).test_rename_column_boolean() - @config.requirements.mysql_check_reflection_or_none def test_change_type_boolean_to_int(self): super(BatchRoundTripMySQLTest, self).test_change_type_boolean_to_int() - @config.requirements.mysql_check_reflection_or_none def test_change_type_int_to_boolean(self): super(BatchRoundTripMySQLTest, self).test_change_type_int_to_boolean() diff --git a/tests/test_environment.py b/tests/test_environment.py index 7e5eb83..4fb6bbe 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -66,7 +66,6 @@ class EnvironmentTest(TestBase): ctx = MigrationContext(ctx.dialect, None, {}) is_(ctx.config, None) - @config.requirements.sqlalchemy_issue_3740 def test_sql_mode_parameters(self): env = self._fixture() diff --git a/tests/test_mysql.py b/tests/test_mysql.py index 4ab4330..d064b92 100644 --- a/tests/test_mysql.py +++ b/tests/test_mysql.py @@ -27,7 +27,6 @@ from alembic.util import sqla_compat class MySQLOpTest(TestBase): - @config.requirements.comments_api def test_create_table_with_comment(self): context = op_fixture("mysql") op.create_table( @@ -37,7 +36,6 @@ class MySQLOpTest(TestBase): ) context.assert_contains("COMMENT='This is a table comment'") - @config.requirements.comments_api def test_create_table_with_column_comments(self): context = op_fixture("mysql") op.create_table( @@ -56,7 +54,6 @@ class MySQLOpTest(TestBase): "COMMENT='This is a table comment'" ) - @config.requirements.comments_api def test_add_column_with_comment(self): context = op_fixture("mysql") op.add_column("t", Column("q", Integer, comment="This is a comment")) @@ -281,7 +278,6 @@ class MySQLOpTest(TestBase): server_default="q", ) - @config.requirements.comments_api def test_alter_column_add_comment(self): context = op_fixture("mysql") op.alter_column( @@ -297,7 +293,6 @@ class MySQLOpTest(TestBase): "COMMENT 'This is a column comment'" ) - @config.requirements.comments_api def test_alter_column_add_comment_quoting(self): context = op_fixture("mysql") op.alter_column( @@ -313,7 +308,6 @@ class MySQLOpTest(TestBase): "COMMENT 'This is a ''column'' comment'" ) - @config.requirements.comments_api def test_alter_column_drop_comment(self): context = op_fixture("mysql") op.alter_column( @@ -327,7 +321,6 @@ class MySQLOpTest(TestBase): context.assert_("ALTER TABLE foo.t MODIFY c BOOL NULL") - @config.requirements.comments_api def test_alter_column_existing_comment(self): context = op_fixture("mysql") op.alter_column( @@ -343,7 +336,6 @@ class MySQLOpTest(TestBase): "COMMENT 'existing column comment'" ) - @config.requirements.comments_api def test_rename_column_existing_comment(self): context = op_fixture("mysql") op.alter_column( @@ -360,7 +352,6 @@ class MySQLOpTest(TestBase): "COMMENT 'existing column comment'" ) - @config.requirements.comments_api def test_alter_column_new_comment_replaces_existing(self): context = op_fixture("mysql") op.alter_column( @@ -377,15 +368,12 @@ class MySQLOpTest(TestBase): "COMMENT 'This is a column comment'" ) - @config.requirements.comments_api def test_create_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("mysql") op.create_table_comment("t2", comment="t2 table", schema="foo") context.assert_("ALTER TABLE foo.t2 COMMENT 't2 table'") - @config.requirements.comments_api - @config.requirements.sqlalchemy_issue_4436 def test_drop_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("mysql") @@ -537,8 +525,6 @@ class MySQLDefaultCompareTest(TestBase): __only_on__ = "mysql" __backend__ = True - __requires__ = ("mysql_timestamp_reflection",) - @classmethod def setup_class(cls): cls.bind = config.db diff --git a/tests/test_oracle.py b/tests/test_oracle.py index b2e704f..7845745 100644 --- a/tests/test_oracle.py +++ b/tests/test_oracle.py @@ -123,15 +123,12 @@ class OpTest(TestBase): "ALTER TABLE t MODIFY c INTEGER", "COMMENT ON COLUMN t.c IS ''" ) - @config.requirements.comments_api def test_create_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("oracle") op.create_table_comment("t2", comment="t2 table", schema="foo") context.assert_("COMMENT ON TABLE foo.t2 IS 't2 table'") - @config.requirements.comments_api - @config.requirements.sqlalchemy_issue_4436 def test_drop_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("oracle") diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index 8c43510..f928868 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -155,7 +155,6 @@ class PostgresqlOpTest(TestBase): 'USING gist ("SomeColumn" WITH >) WHERE ("SomeColumn" > 5)' ) - @config.requirements.comments_api def test_add_column_with_comment(self): context = op_fixture("postgresql") op.add_column("t", Column("q", Integer, comment="This is a comment")) @@ -164,7 +163,6 @@ class PostgresqlOpTest(TestBase): "COMMENT ON COLUMN t.q IS 'This is a comment'", ) - @config.requirements.comments_api def test_alter_column_with_comment(self): context = op_fixture("postgresql") op.alter_column( @@ -181,7 +179,6 @@ class PostgresqlOpTest(TestBase): "COMMENT ON COLUMN foo.t.c IS 'This is a column comment'", ) - @config.requirements.comments_api def test_alter_column_add_comment(self): context = op_fixture("postgresql") op.alter_column( @@ -196,7 +193,6 @@ class PostgresqlOpTest(TestBase): "COMMENT ON COLUMN foo.t.c IS 'This is a column comment'" ) - @config.requirements.comments_api def test_alter_column_add_comment_table_and_column_quoting(self): context = op_fixture("postgresql") op.alter_column( @@ -211,7 +207,6 @@ class PostgresqlOpTest(TestBase): 'COMMENT ON COLUMN foo."T"."C" IS \'This is a column comment\'' ) - @config.requirements.comments_api def test_alter_column_add_comment_quoting(self): context = op_fixture("postgresql") op.alter_column( @@ -226,7 +221,6 @@ class PostgresqlOpTest(TestBase): "COMMENT ON COLUMN foo.t.c IS 'This is a column ''comment'''" ) - @config.requirements.comments_api def test_alter_column_drop_comment(self): context = op_fixture("postgresql") op.alter_column( @@ -240,7 +234,6 @@ class PostgresqlOpTest(TestBase): context.assert_("COMMENT ON COLUMN foo.t.c IS NULL") - @config.requirements.comments_api def test_create_table_with_comment(self): context = op_fixture("postgresql") op.create_table( @@ -255,7 +248,6 @@ class PostgresqlOpTest(TestBase): "COMMENT ON TABLE t2 IS 't2 comment'", ) - @config.requirements.comments_api def test_create_table_with_column_comments(self): context = op_fixture("postgresql") op.create_table( @@ -272,14 +264,12 @@ class PostgresqlOpTest(TestBase): "COMMENT ON COLUMN t2.c2 IS 'c2 comment'", ) - @config.requirements.comments_api def test_create_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("postgresql") op.create_table_comment("t2", comment="t2 table", schema="foo") context.assert_("COMMENT ON TABLE foo.t2 IS 't2 table'") - @config.requirements.comments_api def test_drop_table_comment(self): # this is handled by SQLAlchemy's compilers context = op_fixture("postgresql") diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index 76bf65d..3ea1975 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -159,13 +159,11 @@ class SQLiteDefaultCompareTest(TestBase): None, col, rendered, cols[0]["default"] ) - @config.requirements.sqlalchemy_12 def test_compare_current_timestamp_func(self): self._compare_default_roundtrip( DateTime(), func.datetime("now", "localtime") ) - @config.requirements.sqlalchemy_12 def test_compare_current_timestamp_func_now(self): self._compare_default_roundtrip(DateTime(), func.now()) diff --git a/tests/test_version_traversal.py b/tests/test_version_traversal.py index 5d22d1c..dc5683f 100644 --- a/tests/test_version_traversal.py +++ b/tests/test_version_traversal.py @@ -563,9 +563,7 @@ class TwinMergeTest(MigrationTest): class NotQuiteTwinMergeTest(MigrationTest): - """Test a variant of #297. - - """ + """Test a variant of #297.""" @classmethod def setup_class(cls): |