~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2007-06-09 15:34:07 UTC
  • mto: (2574.1.2 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2576.
  • Revision ID: v.ladeuil+lp@free.fr-20070609153407-c5jx52cfk47jydq5
Fix 110448 by adding a relpath parameter to get_transport.

* bzrlib/tests/__init__.py:
(TestCaseWithMemoryTransport.get_transport,
get_readonly_transport): Add a relpath parameter.

* bzrlib/tests/test_transport.py:
(TestTransportImplementation.get_transport): Add a relpath
parameter.

* bzrlib/tests/test_sftp_transport.py:
(TestCaseWithSFTPServer.get_tranport): Deleted.

* bzrlib/tests/test_dirstate.py:
(TestCaseWithDirState.create_basic_dirstate): Use the new shiny
get_transport !

Show diffs side-by-side

added added

removed removed

Lines of Context:
1617
1617
        self.transport_readonly_server = None
1618
1618
        self.__vfs_server = None
1619
1619
 
1620
 
    def get_transport(self):
1621
 
        """Return a writeable transport for the test scratch space"""
1622
 
        t = get_transport(self.get_url())
 
1620
    def get_transport(self, relpath=None):
 
1621
        """Return a writeable transport.
 
1622
 
 
1623
        This transport is for the test scratch space relative to
 
1624
        "self._test_root""
 
1625
        
 
1626
        :param relpath: a path relative to the base url.
 
1627
        """
 
1628
        t = get_transport(self.get_url(relpath))
1623
1629
        self.assertFalse(t.is_readonly())
1624
1630
        return t
1625
1631
 
1626
 
    def get_readonly_transport(self):
 
1632
    def get_readonly_transport(self, relpath=None):
1627
1633
        """Return a readonly transport for the test scratch space
1628
1634
        
1629
1635
        This can be used to test that operations which should only need
1630
1636
        readonly access in fact do not try to write.
 
1637
 
 
1638
        :param relpath: a path relative to the base url.
1631
1639
        """
1632
 
        t = get_transport(self.get_readonly_url())
 
1640
        t = get_transport(self.get_readonly_url(relpath))
1633
1641
        self.assertTrue(t.is_readonly())
1634
1642
        return t
1635
1643
 
1666
1674
        These should only be downwards relative, not upwards.
1667
1675
        """
1668
1676
        base = self.get_readonly_server().get_url()
1669
 
        if relpath is not None:
1670
 
            if not base.endswith('/'):
1671
 
                base = base + '/'
1672
 
            base = base + relpath
1673
 
        return base
 
1677
        return self._adjust_url(base, relpath)
1674
1678
 
1675
1679
    def get_vfs_only_server(self):
1676
1680
        """Get the vfs only read/write server instance.