summaryrefslogtreecommitdiff
path: root/migrate/tests/changeset/test_changeset.py
diff options
context:
space:
mode:
authorCyril Roelandt <cyril.roelandt@enovance.com>2014-03-19 15:02:40 +0100
committerCyril Roelandt <cyril.roelandt@enovance.com>2014-04-09 17:32:52 +0200
commita03b141a954c7e644f0033defdb1b5b434a7c49a (patch)
tree3515ecc8ab1b2a2218b0fa60aec04de09def8ce5 /migrate/tests/changeset/test_changeset.py
parent07909159ae22dc0d399b9618dcf0f79a1d0332bf (diff)
downloadsqlalchemy-migrate-a03b141a954c7e644f0033defdb1b5b434a7c49a.tar.gz
Port to Python3
Brief summary of the modifications: * Use six for compatibility with both Python 2 and 3; * Replace UserDict.DictMixin with collections.MutableMapping; * Fix relative imports; * Use test-requirements.txt for requirements that are common to both Python 2 and 3, and test-requirements-py{2,3}.txt for version-specific requirements; * Miscellaneous fixes. * Use a specific test_db_py3.cfg file for Python 3, that only runs tests on sqlite. Thanks to Victor Stinner who co-wrote this patch. Change-Id: Ia6dc536c39d274924c21fd5bb619e8e5721e04c4 Co-Authored-By: Victor Stinner <victor.stinner@enovance.com>
Diffstat (limited to 'migrate/tests/changeset/test_changeset.py')
-rw-r--r--migrate/tests/changeset/test_changeset.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/migrate/tests/changeset/test_changeset.py b/migrate/tests/changeset/test_changeset.py
index dcbd473..57d0380 100644
--- a/migrate/tests/changeset/test_changeset.py
+++ b/migrate/tests/changeset/test_changeset.py
@@ -11,6 +11,7 @@ from migrate.changeset import constraint
from migrate.changeset.schema import ColumnDelta
from migrate.tests import fixture
from migrate.tests.fixture.warnings import catch_warnings
+import six
class TestAddDropColumn(fixture.DB):
"""Test add/drop column through all possible interfaces
@@ -400,7 +401,7 @@ class TestAddDropColumn(fixture.DB):
if isinstance(cons,ForeignKeyConstraint):
col_names = []
for col_name in cons.columns:
- if not isinstance(col_name,basestring):
+ if not isinstance(col_name,six.string_types):
col_name = col_name.name
col_names.append(col_name)
result.append(col_names)
@@ -612,7 +613,7 @@ class TestColumnChange(fixture.DB):
self.table.drop()
try:
self.table.create()
- except sqlalchemy.exc.SQLError, e:
+ except sqlalchemy.exc.SQLError:
# SQLite: database schema has changed
if not self.url.startswith('sqlite://'):
raise
@@ -621,7 +622,7 @@ class TestColumnChange(fixture.DB):
if self.table.exists():
try:
self.table.drop(self.engine)
- except sqlalchemy.exc.SQLError,e:
+ except sqlalchemy.exc.SQLError:
# SQLite: database schema has changed
if not self.url.startswith('sqlite://'):
raise
@@ -843,7 +844,7 @@ class TestColumnDelta(fixture.DB):
def verify(self, expected, original, *p, **k):
self.delta = ColumnDelta(original, *p, **k)
- result = self.delta.keys()
+ result = list(self.delta.keys())
result.sort()
self.assertEqual(expected, result)
return self.delta