From 8bdf8b3a947f48c6566c50b6d7177c90e8e5019a Mon Sep 17 00:00:00 2001 From: Philip Jenvey Date: Sun, 24 Jan 2010 21:32:09 +0000 Subject: [PATCH] test_notsane_working needs to run first for dialects that don't supports_sane_rowcount so the other VersioningTests don't ignore the warning it expects (that ignore lasts forever) --- test/orm/test_unitofwork.py | 43 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py index 265ce3fc0b..02340c0034 100644 --- a/test/orm/test_unitofwork.py +++ b/test/orm/test_unitofwork.py @@ -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 -- 2.47.3