]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add some py3k caveats
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Feb 2010 21:38:39 +0000 (21:38 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Feb 2010 21:38:39 +0000 (21:38 +0000)
lib/sqlalchemy/test/testing.py
test/sql/test_types.py

index 31a271a03d3a3ba60f8f9cb9a1ddd25141b6d186..771b8c90fb8c635e4d782765239fa9b29e5f8c37 100644 (file)
@@ -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.
index 532a89d1d416d5f91e7ac2178dd258e57d95c0f8..2a17c72186430618f83b2d3b1f06528ef3325d04 100644 (file)
@@ -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)