~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_serve.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-15 16:07:11 UTC
  • mto: (5743.13.4 config-editor-option)
  • mto: This revision was merged to the branch mainline in revision 5944.
  • Revision ID: v.ladeuil+lp@free.fr-20110515160711-l0og3ady9wuahz1k
Stack.get() provides the registered option default value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Tests of the bzr serve command."""
19
19
 
20
20
import os
21
 
import os.path
22
21
import signal
23
 
import subprocess
24
 
import sys
25
22
import thread
26
23
import threading
27
24
 
28
25
from bzrlib import (
29
26
    builtins,
30
 
    debug,
31
27
    errors,
32
28
    osutils,
33
29
    revision as _mod_revision,
37
33
from bzrlib.branch import Branch
38
34
from bzrlib.bzrdir import BzrDir
39
35
from bzrlib.smart import client, medium
40
 
from bzrlib.smart.server import BzrServerFactory, SmartTCPServer
 
36
from bzrlib.smart.server import (
 
37
    BzrServerFactory,
 
38
    SmartTCPServer,
 
39
    )
41
40
from bzrlib.tests import (
42
41
    TestCaseWithMemoryTransport,
43
42
    TestCaseWithTransport,
44
 
    TestSkipped,
45
43
    )
46
44
from bzrlib.trace import mutter
47
45
from bzrlib.transport import remote
53
51
                                *func_args, **func_kwargs):
54
52
        """Run 'bzr serve', and run the given func in a thread once the server
55
53
        has started.
56
 
        
 
54
 
57
55
        When 'func' terminates, the server will be terminated too.
58
 
        
 
56
 
59
57
        Returns stdout and stderr.
60
58
        """
61
59
        # install hook
164
162
        url = 'bzr://localhost:%d/' % port
165
163
        self.permit_url(url)
166
164
        return process, url
167
 
    
 
165
 
168
166
    def test_bzr_serve_quiet(self):
169
167
        self.make_branch('.')
170
168
        args = ['--port', 'localhost:0', '--quiet']
225
223
        # -Dhpss, and does drop some hpss logging to the file.
226
224
        self.make_branch('.')
227
225
        log_fname = os.getcwd() + '/server.log'
228
 
        self._captureVar('BZR_LOG', log_fname)
 
226
        self.overrideEnv('BZR_LOG', log_fname)
229
227
        process, transport = self.start_server_inet(['-Dhpss'])
230
228
        branch = BzrDir.open_from_transport(transport).open_branch()
231
229
        self.make_read_requests(branch)
334
332
        self.assertEqual(base_url, self.bzr_serve_transport.base)
335
333
        self.assertEqual(base_dir,
336
334
            server_maker.get_base_path(self.bzr_serve_transport))
337