Merge lp:~benji/launchpad/bug-972456 into lp:launchpad

Proposed by Benji York
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 15056
Proposed branch: lp:~benji/launchpad/bug-972456
Merge into: lp:launchpad
Diff against target: 19 lines (+8/-1)
1 file modified
bzrplugins/lpserve/test_lpserve.py (+8/-1)
To merge this branch: bzr merge lp:~benji/launchpad/bug-972456
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+100645@code.launchpad.net

Commit message

Ignore warnings when starting a bzr subprocess.

Description of the change

Bug 972456 is about several test failures that occur when bzr warns
about a badly configured locale.

The problem is that _start_subprocess in
bzrplugins/lpserve/test_lpserve.py assumes that the first line of output
(on stderr) will be the "Listening on socket:" line. When bzr issues
warnings they come before that line so the subsequent assertEqual fails.

To fix this I just keep reading lines of output until we see the
"Listening" line and then proceed.

Lint: the "make lint" report is clean.

QA: this is a test fix only, so no QA step.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrplugins/lpserve/test_lpserve.py'
--- bzrplugins/lpserve/test_lpserve.py 2012-03-29 16:31:02 +0000
+++ bzrplugins/lpserve/test_lpserve.py 2012-04-03 16:19:32 +0000
@@ -437,7 +437,14 @@
437 env_changes=env_changes)437 env_changes=env_changes)
438 trace.mutter('started lp-service subprocess')438 trace.mutter('started lp-service subprocess')
439 expected = 'Listening on socket: %s\n' % (path,)439 expected = 'Listening on socket: %s\n' % (path,)
440 path_line = proc.stderr.readline()440 while True:
441 path_line = proc.stderr.readline()
442 # Stop once we have found the path line.
443 if path_line.startswith('Listening on socket:'):
444 break
445 # If the subprocess has finished, there is no more to read.
446 if proc.poll() is not None:
447 break
441 trace.mutter(path_line)448 trace.mutter(path_line)
442 self.assertEqual(expected, path_line)449 self.assertEqual(expected, path_line)
443 return proc450 return proc