]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Quashed import sets deprecation warning on 2.6.. not wild about this but it seems...
authorJason Kirtland <jek@discorporate.us>
Mon, 10 Nov 2008 22:56:22 +0000 (22:56 +0000)
committerJason Kirtland <jek@discorporate.us>
Mon, 10 Nov 2008 22:56:22 +0000 (22:56 +0000)
lib/sqlalchemy/util.py
test/dialect/postgres.py

index f2f2cdd79c900088c4645b5cdd6107caa1de01f1..297dd738f151ec5d9649a900fcfc6e4aa23235e5 100644 (file)
@@ -4,7 +4,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-import inspect, itertools, new, operator, sets, sys, warnings, weakref
+import inspect, itertools, new, operator, sys, warnings, weakref
 import __builtin__
 types = __import__('types')
 
@@ -18,8 +18,20 @@ except ImportError:
     import dummy_threading as threading
     from dummy_threading import local as ThreadLocal
 
-# TODO: 2.6 will whine about importing `sets`, but I think we still need it to
-# around to support older DB-API modules that return the 2.3 style set.
+if sys.version_info < (2, 6):
+    import sets
+else:
+    # 2.6 deprecates sets.Set, but we still need to be able to detect them
+    # in user code and as return values from DB-APIs
+    ignore = ('ignore', None, DeprecationWarning, None, 0)
+    try:
+        warnings.filters.insert(0, ignore)
+    except Exception:
+        import sets
+    else:
+        import sets
+        warnings.filters.remove(ignore)
+
 set_types = set, sets.Set
 
 EMPTY_SET = frozenset()
index caafb39f64a725715514e0a0351f76a18080acb7..45f9d289ac323e139376c5b791e3b5bd4595764f 100644 (file)
@@ -96,9 +96,11 @@ class ReturningTest(TestBase, AssertsExecutionResults):
             self.assertEqual(result.fetchall(), [(1,)])
 
             # Multiple inserts only return the last row
+            testing.db.echo = True
             result2 = table.insert(postgres_returning=[table]).execute(
                  [{'persons': 2, 'full': False}, {'persons': 3, 'full': True}])
-
+            from pdb import set_trace; set_trace()
+            print vars(result2)
             self.assertEqual(result2.fetchall(), [(3,3,True)])
 
             result3 = table.insert(postgres_returning=[(table.c.id*2).label('double_id')]).execute({'persons': 4, 'full': False})