]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- use open()
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Feb 2011 21:07:38 +0000 (16:07 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Feb 2011 21:07:38 +0000 (16:07 -0500)
- fix list comprehension so we are using correct fk name (py3k picked it up for us ! )

alembic/op.py
tests/__init__.py
tests/test_schema.py

index e402f119c289f521efecb7129f9cd3ce7aaba3fc..77fc7505502c374ea4747cd3985361bd3ccd3897 100644 (file)
@@ -33,8 +33,8 @@ def _foreign_key_constraint(name, source, referent, local_cols, remote_cols):
             *[schema.Column(n, NULLTYPE) for n in remote_cols])
 
     f = schema.ForeignKeyConstraint(local_cols, 
-                                        ["%s.%s" % (referent, name
-                                        for name in remote_cols],
+                                        ["%s.%s" % (referent, n) 
+                                        for n in remote_cols],
                                         name=name
                                         )
     t1.append_constraint(f)
index 7c97f2a6c654b31d04909283cc9afce2fe891418..fea29fd08375c4aa85701853d2a8a87a9bdc1eef 100644 (file)
@@ -40,7 +40,7 @@ def _testing_config():
 def _sqlite_testing_config():
     cfg = _testing_config()
     dir_ = os.path.join(staging_directory, 'scripts')
-    file(cfg.config_file_name, 'w').write("""
+    open(cfg.config_file_name, 'w').write("""
 [alembic]
 script_location = %s
 sqlalchemy.url = sqlite:///%s/foo.db
index 53fc6a9fdd8b3e804146e86cc7fd641ffde77c74..bc68de26b24107ff58fb452cc6be80c00464be59 100644 (file)
@@ -10,7 +10,7 @@ def test_foreign_key():
                     ['foo', 'bar'], ['bat', 'hoho'])
     assert_compiled(
         AddConstraint(fk),
-        "ALTER TABLE t1 ADD CONSTRAINT hoho FOREIGN KEY(foo, bar) "
+        "ALTER TABLE t1 ADD CONSTRAINT fk_test FOREIGN KEY(foo, bar) "
             "REFERENCES t2 (bat, hoho)"
     )