diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-09 20:50:46 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-09 20:50:46 +0000 |
| commit | e7241263aa9db24885b41984b85300178428a60c (patch) | |
| tree | 7c2e9a8bbab97e390d02b13865db5a68d166995a /lib/sqlalchemy/test/testing.py | |
| parent | 7974625e8b86a28f3ac81c3c620df9b2801b133d (diff) | |
| download | sqlalchemy-e7241263aa9db24885b41984b85300178428a60c.tar.gz | |
python3k fixes
Diffstat (limited to 'lib/sqlalchemy/test/testing.py')
| -rw-r--r-- | lib/sqlalchemy/test/testing.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index 16a13d9d3..91e9c68ae 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -9,12 +9,13 @@ import warnings from cStringIO import StringIO from sqlalchemy.test import config, assertsql, util as testutil -from sqlalchemy.util import function_named +from sqlalchemy.util import function_named, py3k from engines import drop_all_tables from sqlalchemy import exc as sa_exc, util, types as sqltypes, schema, pool from nose import SkipTest + _ops = { '<': operator.lt, '>': operator.gt, '==': operator.eq, @@ -593,10 +594,24 @@ class AssertsCompiledSQL(object): c = clause.compile(dialect=dialect, **kw) + # Py3K + ## I kid you not. + ## + ## 1. Doesn't work: + ## http://mail.python.org/pipermail/python-3000/2008-February/012144.html + ## + ## 2. no more setdefaultencoding(). (although this is undocumented) + ## + ## 3. Therefore: + ## http://docs.python.org/3.1/library/sys.html#sys.stdin + ## + #sys.stdout.buffer.write(("\nSQL String:\n" + str(c) + repr(getattr(c, 'params', {}))).encode('utf-8')) + # Py2K print "\nSQL String:\n" + str(c) + repr(getattr(c, 'params', {})) - + # end Py2K + cc = re.sub(r'[\n\t]', '', str(c)) - + eq_(cc, result, "%r != %r on dialect %r" % (cc, result, dialect)) if checkparams is not None: |
