~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.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:
22
22
    bzrdir,
23
23
    conflicts,
24
24
    errors,
 
25
    transport,
25
26
    workingtree,
26
27
    )
27
28
from bzrlib.branch import Branch
29
30
from bzrlib.lockdir import LockDir
30
31
from bzrlib.mutabletree import needs_tree_write_lock
31
32
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
32
 
from bzrlib.transport import get_transport
33
33
from bzrlib.workingtree import (
34
34
    TreeEntry,
35
35
    TreeDirectory,
138
138
            dir.create_repository()
139
139
            dir.create_branch()
140
140
            format.initialize(dir)
141
 
            t = get_transport(url)
 
141
            t = transport.get_transport(url)
142
142
            found_format = workingtree.WorkingTreeFormat.find_format(dir)
143
143
            self.failUnless(isinstance(found_format, format.__class__))
144
144
        check_format(workingtree.WorkingTreeFormat3(), "bar")