From: Mike Bayer Date: Tue, 23 Feb 2010 21:38:39 +0000 (+0000) Subject: add some py3k caveats X-Git-Tag: rel_0_6beta2~132 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=189414fe2999d281ad8b45b89f97a3c56fc5e84b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add some py3k caveats --- diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index 31a271a03d..771b8c90fb 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -33,7 +33,7 @@ db = None # more sugar, installed by __init__ requires = None -def fails_if(callable_): +def fails_if(callable_, reason=None): """Mark a test as expected to fail if callable_ returns True. If the callable returns false, the test is run and reported as normal. diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 532a89d1d4..2a17c72186 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -421,7 +421,11 @@ class UnicodeTest(TestBase, AssertsExecutionResults): # end Py2K eq_(uni(unicodedata), unicodedata.encode('utf-8')) - + + @testing.fails_if( + lambda: testing.db_spec("postgresql+pg8000")(testing.db) and util.py3k, + "pg8000 appropriately does not accept 'bytes' for a VARCHAR column." + ) def test_ignoring_unicode_error(self): """checks String(unicode_error='ignore') is passed to underlying codec.""" @@ -488,7 +492,9 @@ class UnicodeTest(TestBase, AssertsExecutionResults): result.close() x = ascii_row['plain_varchar_no_coding_error'] - a = hexlify(x) + # on python3 "x" comes back as string (i.e. unicode), + # hexlify requires bytes + a = hexlify(x.encode('utf-8')) b = hexlify(asciidata) eq_(a, b)