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
1=== modified file 'bzrplugins/lpserve/test_lpserve.py'
2--- bzrplugins/lpserve/test_lpserve.py 2012-03-29 16:31:02 +0000
3+++ bzrplugins/lpserve/test_lpserve.py 2012-04-03 16:19:32 +0000
4@@ -437,7 +437,14 @@
5 env_changes=env_changes)
6 trace.mutter('started lp-service subprocess')
7 expected = 'Listening on socket: %s\n' % (path,)
8- path_line = proc.stderr.readline()
9+ while True:
10+ path_line = proc.stderr.readline()
11+ # Stop once we have found the path line.
12+ if path_line.startswith('Listening on socket:'):
13+ break
14+ # If the subprocess has finished, there is no more to read.
15+ if proc.poll() is not None:
16+ break
17 trace.mutter(path_line)
18 self.assertEqual(expected, path_line)
19 return proc