From: Mike Bayer Date: Fri, 25 Feb 2011 21:07:38 +0000 (-0500) Subject: - use open() X-Git-Tag: rel_0_1_0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faed4712416556f98b6834a9c5f02f865d1d29b5;p=thirdparty%2Fsqlalchemy%2Falembic.git - use open() - fix list comprehension so we are using correct fk name (py3k picked it up for us ! ) --- diff --git a/alembic/op.py b/alembic/op.py index e402f119..77fc7505 100644 --- a/alembic/op.py +++ b/alembic/op.py @@ -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) diff --git a/tests/__init__.py b/tests/__init__.py index 7c97f2a6..fea29fd0 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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 diff --git a/tests/test_schema.py b/tests/test_schema.py index 53fc6a9f..bc68de26 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -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)" )