~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to bzrplugins/lpserve/test_lpserve.py

  • Committer: John Arbash Meinel
  • Date: 2010-09-03 17:17:53 UTC
  • mto: This revision was merged to the branch mainline in revision 11773.
  • Revision ID: jameinel@falco-lucid-20100903171753-czverbe3v427ki4u
Change the code to allow --no-preload to help the test suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
        old_val = osutils.set_or_unset_env('BZR_PLUGIN_PATH',
265
265
                                           lpserve.__path__[0])
266
266
        self.addCleanup(osutils.set_or_unset_env, 'BZR_PLUGIN_PATH', old_val)
267
 
        proc = self.start_bzr_subprocess(['lp-service', '--port', '127.0.0.1:0'])
 
267
        proc = self.start_bzr_subprocess(
 
268
            ['lp-service', '--port', '127.0.0.1:0', '--no-preload'])
268
269
        trace.mutter('started lp-service subprocess')
269
 
        preload_line = proc.stderr.readline()
270
 
        self.assertStartsWith(preload_line, 'Preloading')
 
270
        # preload_line = proc.stderr.readline()
 
271
        # self.assertStartsWith(preload_line, 'Preloading')
271
272
        prefix = 'Listening on port: '
272
273
        port_line = proc.stderr.readline()
273
274
        self.assertStartsWith(port_line, prefix)
292
293
        self.assertEqual('quit command requested... exiting\n', response)
293
294
 
294
295
    def test_fork_child_hello(self):
295
 
        response = self.send_message_to_service('fork lp-serve --inet 2\n')
 
296
        response = self.send_message_to_service('fork rocks\n')
296
297
        if response.startswith('FAILURE'):
297
298
            self.fail('Fork request failed')
298
299
        self.assertContainsRe(response, '/lp-forking-service-child-')
303
304
        child_stdout = open(stdout_path, 'rb')
304
305
        child_stderr = open(stderr_path, 'rb')
305
306
        child_stdin = open(stdin_path, 'wb')
306
 
        child_stdin.write('hello\n')
307
307
        child_stdin.close()
308
308
        stdout_content = child_stdout.read()
309
309
        stderr_content = child_stderr.read()
310
 
        self.assertEqual('ok\x012\n', stdout_content)
 
310
        self.assertEqual('it sure does!\n', stdout_content)
311
311
        self.assertEqual('', stderr_content)