← Back to team overview

launchpad-reviewers team mailing list archive

lp:~frankban/launchpad/bug-881205-TestBranchChangedErrorHandling-stderr into lp:launchpad

 

Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-881205-TestBranchChangedErrorHandling-stderr into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #881205 in Launchpad itself: "TestBranchChangedErrorHandling.test_branchChanged_stderr_text writes to console during the test"
  https://bugs.launchpad.net/launchpad/+bug/881205

For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-881205-TestBranchChangedErrorHandling-stderr/+merge/89699

= Summary =

TestBranchChangedErrorHandling.test_branchChanged_stderr_text writes to 
console during the test.


== Proposed fix ==

We need to avoid this because it may interfere 
with subunit, which is used in LXC parallel testing.


== Pre-implementation notes ==

The problem is in
`lp.codehosting.vfs.branchfs.LaunchpadServer.branchChanged:697`.
The installed twisted logging observer writes the error message to console.


== Implementation details ==

Emptying the twisted logging observers list while making the test fixes 
the problem.


== Demo and Q/A ==

bin/test -vvt BranchChangedErrorHandling
no-qa


== lint ==

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/codehosting/vfs/tests/test_branchfs.py
-- 
https://code.launchpad.net/~frankban/launchpad/bug-881205-TestBranchChangedErrorHandling-stderr/+merge/89699
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~frankban/launchpad/bug-881205-TestBranchChangedErrorHandling-stderr into lp:launchpad.
=== modified file 'lib/lp/codehosting/vfs/tests/test_branchfs.py'
--- lib/lp/codehosting/vfs/tests/test_branchfs.py	2012-01-01 02:58:52 +0000
+++ lib/lp/codehosting/vfs/tests/test_branchfs.py	2012-01-23 15:11:25 +0000
@@ -43,6 +43,7 @@
 from testtools.deferredruntest import (
     assert_fails_with,
     AsynchronousDeferredRunTest,
+    run_with_log_observers,
     )
 from twisted.internet import defer
 
@@ -1081,7 +1082,8 @@
         # endpoint. We will then check the error handling.
         db_branch = self.factory.makeAnyBranch(
             branch_type=BranchType.HOSTED, owner=self.requester)
-        branch = self.make_branch(db_branch.unique_name)
+        branch = run_with_log_observers(
+            [], self.make_branch, db_branch.unique_name)
         branch.lock_write()
         branch.unlock()
         stderr_text = sys.stderr.getvalue()