/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/tests/blackbox/test_serve.py

Add bzrlib.pyutils, which has get_named_object, a wrapper around __import__.

This is used to replace various ad hoc implementations of the same logic,
notably the version used in registry's _LazyObjectGetter which had a bug when
getting a module without also getting a member.  And of course, this new
function has unit tests, unlike the replaced code.

This also adds a KnownHooksRegistry subclass to provide a more natural home for
some other logic.

I'm not thrilled about the name of the new module or the new functions, but it's
hard to think of good names for such generic functionality.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    errors,
32
32
    osutils,
33
33
    revision as _mod_revision,
 
34
    transport,
34
35
    urlutils,
35
36
    )
36
37
from bzrlib.branch import Branch
43
44
    TestSkipped,
44
45
    )
45
46
from bzrlib.trace import mutter
46
 
from bzrlib.transport import get_transport, remote
 
47
from bzrlib.transport import remote
47
48
 
48
49
 
49
50
class TestBzrServeBase(TestCaseWithTransport):
192
193
    def test_bzr_serve_port_readonly(self):
193
194
        """bzr server should provide a read only filesystem by default."""
194
195
        process, url = self.start_server_port()
195
 
        transport = get_transport(url)
196
 
        self.assertRaises(errors.TransportNotPossible, transport.mkdir, 'adir')
 
196
        t = transport.get_transport(url)
 
197
        self.assertRaises(errors.TransportNotPossible, t.mkdir, 'adir')
197
198
        self.assertServerFinishesCleanly(process)
198
199
 
199
200
    def test_bzr_serve_port_readwrite(self):