]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
test_notsane_working needs to run first for dialects that don't
authorPhilip Jenvey <pjenvey@underboss.org>
Sun, 24 Jan 2010 21:32:09 +0000 (21:32 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Sun, 24 Jan 2010 21:32:09 +0000 (21:32 +0000)
supports_sane_rowcount so the other VersioningTests don't ignore the warning it
expects (that ignore lasts forever)

test/orm/test_unitofwork.py

index 265ce3fc0bfa6cd2deff5948e1d30184e4c475f3..02340c0034d5e5d202fd7e3bb8775d5e3f784625 100644 (file)
@@ -67,6 +67,29 @@ class VersioningTest(_base.MappedTest):
         class Foo(_base.ComparableEntity):
             pass
 
+    @engines.close_open_connections
+    @testing.resolve_artifact_names
+    def test_0notsane_warning(self):
+        # This test relies on an SAWarning being emitted, but the
+        # subsequent tests' emits_warning cause that SAWarning to be
+        # ignored forever. So it must run first
+        save = testing.db.dialect.supports_sane_rowcount
+        testing.db.dialect.supports_sane_rowcount = False
+        try:
+            mapper(Foo, version_table, 
+                    version_id_col=version_table.c.version_id)
+
+            s1 = create_session(autocommit=False)
+            f1 = Foo(value='f1')
+            f2 = Foo(value='f2')
+            s1.add_all((f1, f2))
+            s1.commit()
+
+            f1.value='f1rev2'
+            assert_raises(sa.exc.SAWarning, s1.commit)
+        finally:
+            testing.db.dialect.supports_sane_rowcount = save
+
     @testing.emits_warning(r'.*does not support updated rowcount')
     @engines.close_open_connections
     @testing.resolve_artifact_names
@@ -113,26 +136,6 @@ class VersioningTest(_base.MappedTest):
         else:
             s1.commit()
 
-    @engines.close_open_connections
-    @testing.resolve_artifact_names
-    def test_notsane_warning(self):
-        save = testing.db.dialect.supports_sane_rowcount
-        testing.db.dialect.supports_sane_rowcount = False
-        try:
-            mapper(Foo, version_table, 
-                    version_id_col=version_table.c.version_id)
-
-            s1 = create_session(autocommit=False)
-            f1 = Foo(value='f1')
-            f2 = Foo(value='f2')
-            s1.add_all((f1, f2))
-            s1.commit()
-
-            f1.value='f1rev2'
-            assert_raises(sa.exc.SAWarning, s1.commit)
-        finally:
-            testing.db.dialect.supports_sane_rowcount = save
-
     @testing.emits_warning(r'.*does not support updated rowcount')
     @engines.close_open_connections
     @testing.resolve_artifact_names