← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/enable-isolation-tests-bug-551751 into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/enable-isolation-tests-bug-551751 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #551751 ordering issues in test_isolation
  https://bugs.launchpad.net/bugs/551751

For more details, see:
https://code.launchpad.net/~allenap/launchpad/enable-isolation-tests-bug-551751/+merge/47164

Amends TestIsolation.setUp() - see the comment I've added to the code
- and re-enables the test methods.

-- 
https://code.launchpad.net/~allenap/launchpad/enable-isolation-tests-bug-551751/+merge/47164
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/enable-isolation-tests-bug-551751 into lp:launchpad.
=== modified file 'lib/lp/bugs/externalbugtracker/tests/test_isolation.py'
--- lib/lp/bugs/externalbugtracker/tests/test_isolation.py	2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/externalbugtracker/tests/test_isolation.py	2011-01-22 18:02:00 +0000
@@ -5,8 +5,6 @@
 
 __metaclass__ = type
 
-import unittest
-
 from psycopg2.extensions import TRANSACTION_STATUS_IDLE
 from storm.zope.interfaces import IZStorm
 import transaction
@@ -24,12 +22,14 @@
     def createTransaction(self):
         stores = list(store for _, store in getUtility(IZStorm).iterstores())
         self.failUnless(len(stores) > 0, "No stores to test.")
-        stores[0].execute('SELECT 1')
+        # One or more of the stores may be set to auto-commit. The transaction
+        # status remains unchanged for these stores hence they are not useful
+        # for these tests, so execute a query in every store; one of them will
+        # have a transactional state.
+        for store in stores:
+            store.execute('SELECT 1')
 
     def test_gen_store_statuses(self):
-        # XXX: AaronBentley 2010-03-30 bug=551751: Test fails inconsistently.
-        return
-
         # All stores are either disconnected or idle when all
         # transactions have been aborted.
         transaction.abort()
@@ -44,9 +44,6 @@
                 for _, status in isolation.gen_store_statuses()))
 
     def test_is_transaction_in_progress(self):
-        # XXX: AaronBentley 2010-03-30 bug=551751: Test fails inconsistently.
-        return
-
         # is_transaction_in_progress() returns False when all
         # transactions have been aborted.
         transaction.abort()
@@ -57,9 +54,6 @@
         self.failUnless(isolation.is_transaction_in_progress())
 
     def test_check_no_transaction(self):
-        # XXX: AaronBentley 2010-03-30 bug=551751: Test fails inconsistently.
-        return
-
         # check_no_transaction() should be a no-op when there are no
         # transactions in operation.
         transaction.abort()
@@ -72,9 +66,6 @@
             isolation.check_no_transaction)
 
     def test_ensure_no_transaction(self):
-        # XXX: AaronBentley 2010-03-30 bug=551751: Test fails inconsistently.
-        return
-
         # ensure_no_transaction() is a decorator that raises
         # TransactionInProgress if a transaction has begun, else it
         # simply calls the wrapped function.
@@ -91,7 +82,3 @@
         # transaction has begun.
         self.createTransaction()
         self.assertRaises(isolation.TransactionInProgress, echo)
-
-
-def test_suite():
-    return unittest.TestLoader().loadTestsFromName(__name__)