diff options
author | ijl <uijllji@gmail.com> | 2013-10-15 16:01:25 -0400 |
---|---|---|
committer | ijl <uijllji@gmail.com> | 2013-10-15 16:01:25 -0400 |
commit | f17e8a4452de1363263d4aad9b24612570d64ccc (patch) | |
tree | 0bad60781d6f74a668743a7337a707e4006a5fe8 | |
parent | 52cfa74e094c32910fa1076375f1ae0c9795d45d (diff) | |
download | sqlalchemy-pr/34.tar.gz |
ForeignKeyConstraint reflection test respects MySQL limitationspr/34
-rw-r--r-- | test/engine/test_reflection.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index 3b23bf31a..c36052781 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -608,21 +608,29 @@ class ReflectionTest(fixtures.TestBase, ComparesTables): """test that foreign key reflection includes options (on backends with {dialect}.get_foreign_keys() support)""" - # fk whose attributes we're testing on reflection - addresses_user_id_fkey = sa.ForeignKey( - 'users.id', - name = 'addresses_user_id_fkey', - match='FULL', - onupdate='RESTRICT', - ondelete='RESTRICT', - deferrable=True, - initially='DEFERRED' - ) - - # only test implemented attrs if testing.against('postgresql'): test_attrs = ('match', 'onupdate', 'ondelete', 'deferrable', 'initially') + addresses_user_id_fkey = sa.ForeignKey( + # Each option is specifically not a Postgres default, or + # it won't be returned by PG's inspection + 'users.id', + name = 'addresses_user_id_fkey', + match='FULL', + onupdate='RESTRICT', + ondelete='RESTRICT', + deferrable=True, + initially='DEFERRED' + ) elif testing.against('mysql'): + # MATCH, DEFERRABLE, and INITIALLY cannot be defined for MySQL + # ON UPDATE and ON DELETE have defaults of RESTRICT, which are + # elided by MySQL's inspection + addresses_user_id_fkey = sa.ForeignKey( + 'users.id', + name = 'addresses_user_id_fkey', + onupdate='CASCADE', + ondelete='CASCADE' + ) test_attrs = ('onupdate', 'ondelete') meta = self.metadata |