~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: 2009-06-22 12:52:39 UTC
  • mto: (4471.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4472.
  • Revision ID: v.ladeuil+lp@free.fr-20090622125239-kabo9smxt9c3vnir
Use a consistent scheme for naming pyrex source files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Tests of the bzr serve command."""
48
48
        result = self.finish_bzr_subprocess(process)
49
49
        self.assertEqual('', result[0])
50
50
        self.assertEqual('', result[1])
51
 
    
 
51
 
52
52
    def assertServerFinishesCleanly(self, process):
53
53
        """Shutdown the bzr serve instance process looking for errors."""
54
54
        # Shutdown the server
97
97
        args = ['serve', '--port', 'localhost:0']
98
98
        args.extend(extra_options)
99
99
        process = self.start_bzr_subprocess(args, skip_if_plan_to_signal=True)
100
 
        port_line = process.stdout.readline()
 
100
        port_line = process.stderr.readline()
101
101
        prefix = 'listening on port: '
102
102
        self.assertStartsWith(port_line, prefix)
103
103
        port = int(port_line[len(prefix):])
138
138
        self.make_read_requests(branch)
139
139
        self.assertServerFinishesCleanly(process)
140
140
 
 
141
    def test_bzr_serve_supports_protocol(self):
 
142
        # Make a branch
 
143
        self.make_branch('.')
 
144
 
 
145
        process, url = self.start_server_port(['--allow-writes',
 
146
                                               '--protocol=bzr'])
 
147
 
 
148
        # Connect to the server
 
149
        branch = Branch.open(url)
 
150
        self.make_read_requests(branch)
 
151
        self.assertServerFinishesCleanly(process)
 
152
 
141
153
    def test_bzr_connect_to_bzr_ssh(self):
142
154
        """User acceptance that get_transport of a bzr+ssh:// behaves correctly.
143
155
 
148
160
        except ParamikoNotPresent:
149
161
            raise TestSkipped('Paramiko not installed')
150
162
        from bzrlib.tests.stub_sftp import StubServer
151
 
        
 
163
 
152
164
        # Make a branch
153
165
        self.make_branch('a_branch')
154
166
 
167
179
                proc = subprocess.Popen(
168
180
                    command, shell=True, stdin=subprocess.PIPE,
169
181
                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
170
 
                
 
182
 
171
183
                # XXX: horribly inefficient, not to mention ugly.
172
184
                # Start a thread for each of stdin/out/err, and relay bytes from
173
185
                # the subprocess to channel and vice versa.
200
212
        # Access the branch via a bzr+ssh URL.  The BZR_REMOTE_PATH environment
201
213
        # variable is used to tell bzr what command to run on the remote end.
202
214
        path_to_branch = osutils.abspath('a_branch')
203
 
        
 
215
 
204
216
        orig_bzr_remote_path = os.environ.get('BZR_REMOTE_PATH')
205
217
        bzr_remote_path = self.get_bzr_path()
206
218
        if sys.platform == 'win32':
226
238
            ['%s serve --inet --directory=/ --allow-writes'
227
239
             % bzr_remote_path],
228
240
            self.command_executed)
229
 
        
 
241