/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/chroot.py

Rework test_script a little bit.


Don't allow someone to request a stdin request to echo.
Echo never reads from stdin, it just echos its arguments.
You use 'cat' if you want to read from stdin.

A few other fixes because the tests were using filenames
that are actually illegal on Windows, rather than just
nonexistant.


Change the exception handling for commands so that
unknown errors don't get silently squashed and then
turn into hard-to-debug errors later.

test_script now passes on Windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2009 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
19
19
"""
20
20
 
21
21
from bzrlib.transport import (
 
22
    get_transport,
22
23
    pathfilter,
23
24
    register_transport,
 
25
    Server,
 
26
    Transport,
 
27
    unregister_transport,
24
28
    )
25
29
 
26
30
 
44
48
    def _factory(self, url):
45
49
        return ChrootTransport(self, url)
46
50
 
47
 
    def start_server(self):
 
51
    def setUp(self):
48
52
        self.scheme = 'chroot-%d:///' % id(self)
49
53
        register_transport(self.scheme, self._factory)
50
54
 
61
65
        return self._relpath_from_server_root(relpath)
62
66
 
63
67
 
 
68
class TestingChrootServer(ChrootServer):
 
69
 
 
70
    def __init__(self):
 
71
        """TestingChrootServer is not usable until setUp is called."""
 
72
        ChrootServer.__init__(self, None)
 
73
 
 
74
    def setUp(self, backing_server=None):
 
75
        """Setup the Chroot on backing_server."""
 
76
        if backing_server is not None:
 
77
            self.backing_transport = get_transport(backing_server.get_url())
 
78
        else:
 
79
            self.backing_transport = get_transport('.')
 
80
        ChrootServer.setUp(self)
 
81
 
 
82
 
64
83
def get_test_permutations():
65
84
    """Return the permutations to be used in testing."""
66
 
    from bzrlib.tests import test_server
67
 
    return [(ChrootTransport, test_server.TestingChrootServer)]
 
85
    return [(ChrootTransport, TestingChrootServer)]