|
| 1 | +from alembic.testing.suite import * # noqa |
| 2 | +from sqlalchemy.testing import skip |
| 3 | +from alembic.testing.suite import AutogenerateFKOptionsTest as _AutogenerateFKOptionsTest |
| 4 | +from alembic.testing.suite import AutogenerateForeignKeysTest as _AutogenerateForeignKeysTest |
| 5 | +from alembic.testing.suite import BackendAlterColumnTest as _BackendAlterColumnTest |
| 6 | +from alembic.testing.suite import IncludeHooksTest as _IncludeHooksTest |
| 7 | + |
| 8 | + |
| 9 | +class AutogenerateFKOptionsTest(_AutogenerateFKOptionsTest): |
| 10 | + def test_change_ondelete_from_restrict(self): |
| 11 | + if config.db.dialect._is_v202plus: # noqa |
| 12 | + super().test_change_ondelete_from_restrict() |
| 13 | + |
| 14 | + def test_change_onupdate_from_restrict(self): |
| 15 | + if config.db.dialect._is_v202plus: # noqa |
| 16 | + super().test_change_onupdate_from_restrict() |
| 17 | + |
| 18 | + def test_nochange_ondelete(self): |
| 19 | + if config.db.dialect._is_v202plus: # noqa |
| 20 | + super().test_nochange_ondelete() |
| 21 | + |
| 22 | + def test_nochange_ondelete_noaction(self): |
| 23 | + if config.db.dialect._is_v202plus: # noqa |
| 24 | + super().test_nochange_ondelete_noaction() |
| 25 | + |
| 26 | + def test_nochange_ondelete_restrict(self): |
| 27 | + if config.db.dialect._is_v202plus: # noqa |
| 28 | + super().test_nochange_ondelete_restrict() |
| 29 | + |
| 30 | + def test_nochange_onupdate(self): |
| 31 | + if config.db.dialect._is_v202plus: # noqa |
| 32 | + super().test_nochange_onupdate() |
| 33 | + |
| 34 | + def test_nochange_onupdate_noaction(self): |
| 35 | + if config.db.dialect._is_v202plus: # noqa |
| 36 | + super().test_nochange_onupdate_noaction() |
| 37 | + |
| 38 | + def test_nochange_onupdate_restrict(self): |
| 39 | + if config.db.dialect._is_v202plus: # noqa |
| 40 | + super().test_nochange_onupdate_restrict() |
| 41 | + |
| 42 | + |
| 43 | +class AutogenerateForeignKeysTest(_AutogenerateForeignKeysTest): |
| 44 | + def test_casing_convention_changed_so_put_drops_first(self): |
| 45 | + if config.db.dialect._is_v202plus: # noqa |
| 46 | + super().test_casing_convention_changed_so_put_drops_first() |
| 47 | + |
| 48 | + def test_no_change(self): |
| 49 | + if config.db.dialect._is_v202plus: # noqa |
| 50 | + super().test_no_change() |
| 51 | + |
| 52 | + def test_no_change_colkeys(self): |
| 53 | + if config.db.dialect._is_v202plus: # noqa |
| 54 | + super().test_no_change_colkeys() |
| 55 | + |
| 56 | + def test_no_change_composite_fk(self): |
| 57 | + if config.db.dialect._is_v202plus: # noqa |
| 58 | + super().test_no_change_composite_fk() |
| 59 | + |
| 60 | + def test_remove_composite_fk(self): |
| 61 | + if config.db.dialect._is_v202plus: # noqa |
| 62 | + super().test_remove_composite_fk() |
| 63 | + |
| 64 | + def test_remove_fk(self): |
| 65 | + if config.db.dialect._is_v202plus: # noqa |
| 66 | + super().test_remove_fk() |
| 67 | + |
| 68 | + |
| 69 | +class BackendAlterColumnTest(_BackendAlterColumnTest): |
| 70 | + def test_modify_nullable_to_non(self): |
| 71 | + # we seem to need autocommit for this operation |
| 72 | + with self.op.get_context().autocommit_block(): |
| 73 | + super().test_modify_nullable_to_non() |
| 74 | + |
| 75 | + @skip("cockroachdb") # noqa |
| 76 | + def test_modify_type_int_str(self): |
| 77 | + # TODO: enable this test when warning removed for ALTER COLUMN int → string |
| 78 | + pass |
| 79 | + |
| 80 | + |
| 81 | +class IncludeHooksTest(_IncludeHooksTest): |
| 82 | + @combinations(("object",), ("name",)) # noqa |
| 83 | + def test_change_fk(self, hook_type): |
| 84 | + if config.db.dialect._is_v202plus: # noqa |
| 85 | + super().test_change_fk(hook_type) |
| 86 | + |
| 87 | + @combinations(("object",), ("name",)) # noqa |
| 88 | + def test_remove_connection_fk(self, hook_type): |
| 89 | + if config.db.dialect._is_v202plus: # noqa |
| 90 | + super().test_remove_connection_fk(hook_type) |
0 commit comments