~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Make make_branch_and_tree fall back to creating a local checkout if the transport doesn't support working trees, allowing several more Remote tests to pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1652
1652
 
1653
1653
        This will fail if the original default transport for this test
1654
1654
        case wasn't backed by the working directory, as the branch won't
1655
 
        be on disk for us to open it.  
 
1655
        be on disk for us to open it.
1656
1656
 
1657
1657
        :param format: The BzrDirFormat.
1658
1658
        :returns: the WorkingTree.
1666
1666
            return b.bzrdir.create_workingtree()
1667
1667
        except errors.NotLocalUrl:
1668
1668
            # We can only make working trees locally at the moment.  If the
1669
 
            # transport can't support them, then reopen the branch on a local
1670
 
            # transport, and create the working tree there.  
1671
 
            #
1672
 
            # Possibly we should instead keep
1673
 
            # the non-disk-backed branch and create a local checkout?
1674
 
            bd = bzrdir.BzrDir.open(relpath)
1675
 
            return bd.create_workingtree()
 
1669
            # transport can't support them, then we keep the non-disk-backed
 
1670
            # branch and create a local checkout.
 
1671
            if not os.path.exists('_checkouts'):
 
1672
                os.mkdir('_checkouts')
 
1673
            return b.create_checkout('_checkouts/' + relpath)
1676
1674
 
1677
1675
    def assertIsDirectory(self, relpath, transport):
1678
1676
        """Assert that relpath within transport is a directory.