← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~benji/launchpad/bug-992692 into lp:launchpad

 

Benji York has proposed merging lp:~benji/launchpad/bug-992692 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #992692 in Launchpad itself: "lp.services.mail.tests.test_incoming.TestIncoming.test_invalid_to_addresses fails intermittenty/rarely in parallel tests"
  https://bugs.launchpad.net/launchpad/+bug/992692

For more details, see:
https://code.launchpad.net/~benji/launchpad/bug-992692/+merge/104599

Several tests add log handlers that transmute log entries into OOPSes.  Some other tests then log things and expect there to be no OOPSes and generate test failures when that expectation is not met.

This branch clears out any existing handlers at the start of each test case.

The full test suite has been run with this change in place and all tests passed.

The "make lint" report is clean.
-- 
https://code.launchpad.net/~benji/launchpad/bug-992692/+merge/104599
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~benji/launchpad/bug-992692 into lp:launchpad.
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py	2012-04-25 13:45:25 +0000
+++ lib/lp/testing/__init__.py	2012-05-03 19:14:22 +0000
@@ -647,6 +647,11 @@
             self.addCleanup(
                 self.attachLibrarianLog,
                 LibrarianLayer.librarian_fixture)
+        # Remove all log handlers, tests should not depend on global logging
+        # config but should make their own config instead.
+        logger = logging.getLogger()
+        for handler in logger.handlers:
+            logger.removeHandler(handler)
 
     def assertStatementCount(self, expected_count, function, *args, **kwargs):
         """Assert that the expected number of SQL statements occurred.


Follow ups