summaryrefslogtreecommitdiff
path: root/migrate/tests/versioning/test_shell.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/versioning/test_shell.py
parent07909159ae22dc0d399b9618dcf0f79a1d0332bf (diff)
downloadsqalchemy-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/versioning/test_shell.py')
-rw-r--r--migrate/tests/versioning/test_shell.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/migrate/tests/versioning/test_shell.py b/migrate/tests/versioning/test_shell.py
index 743828d..62dc8e0 100644
--- a/migrate/tests/versioning/test_shell.py
+++ b/migrate/tests/versioning/test_shell.py
@@ -5,7 +5,8 @@ import os
import sys
import tempfile
-from cStringIO import StringIO
+import six
+from six.moves import cStringIO
from sqlalchemy import MetaData, Table
from migrate.exceptions import *
@@ -29,7 +30,7 @@ class TestShellCommands(Shell):
# we can only test that we get some output
for cmd in api.__all__:
result = self.env.run('migrate help %s' % cmd)
- self.assertTrue(isinstance(result.stdout, basestring))
+ self.assertTrue(isinstance(result.stdout, six.string_types))
self.assertTrue(result.stdout)
self.assertFalse(result.stderr)
@@ -61,11 +62,11 @@ class TestShellCommands(Shell):
def _check_error(self,args,code,expected,**kw):
original = sys.stderr
try:
- actual = StringIO()
+ actual = cStringIO()
sys.stderr = actual
try:
shell.main(args,**kw)
- except SystemExit, e:
+ except SystemExit as e:
self.assertEqual(code,e.args[0])
else:
self.fail('No exception raised')
@@ -502,7 +503,7 @@ class TestShellDatabase(Shell, DB):
result = self.env.run('migrate create_model %s %s' % (self.url, repos_path))
temp_dict = dict()
- exec result.stdout in temp_dict
+ six.exec_(result.stdout, temp_dict)
# TODO: breaks on SA06 and SA05 - in need of total refactor - use different approach