/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/test_selftest.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-02 17:08:29 UTC
  • mto: This revision was merged to the branch mainline in revision 5369.
  • Revision ID: john@arbash-meinel.com-20100802170829-l0ti5v5rvcua32ia
Pyrex doesn't allow sizeof(class), so we have to unroll it manually.

Show diffs side-by-side

added added

removed removed

Lines of Context:
609
609
                l.attempt_lock()
610
610
        test = TestDanglingLock('test_function')
611
611
        result = test.run()
 
612
        total_failures = result.errors + result.failures
612
613
        if self._lock_check_thorough:
613
 
            self.assertEqual(1, len(result.errors))
 
614
            self.assertLength(1, total_failures)
614
615
        else:
615
616
            # When _lock_check_thorough is disabled, then we don't trigger a
616
617
            # failure
617
 
            self.assertEqual(0, len(result.errors))
 
618
            self.assertLength(0, total_failures)
618
619
 
619
620
 
620
621
class TestTestCaseWithTransport(tests.TestCaseWithTransport):
621
622
    """Tests for the convenience functions TestCaseWithTransport introduces."""
622
623
 
623
624
    def test_get_readonly_url_none(self):
624
 
        from bzrlib.transport import get_transport
625
625
        from bzrlib.transport.readonly import ReadonlyTransportDecorator
626
626
        self.vfs_transport_factory = memory.MemoryServer
627
627
        self.transport_readonly_server = None
629
629
        # for the server
630
630
        url = self.get_readonly_url()
631
631
        url2 = self.get_readonly_url('foo/bar')
632
 
        t = get_transport(url)
633
 
        t2 = get_transport(url2)
 
632
        t = transport.get_transport(url)
 
633
        t2 = transport.get_transport(url2)
634
634
        self.failUnless(isinstance(t, ReadonlyTransportDecorator))
635
635
        self.failUnless(isinstance(t2, ReadonlyTransportDecorator))
636
636
        self.assertEqual(t2.base[:-1], t.abspath('foo/bar'))
637
637
 
638
638
    def test_get_readonly_url_http(self):
639
639
        from bzrlib.tests.http_server import HttpServer
640
 
        from bzrlib.transport import get_transport
641
640
        from bzrlib.transport.http import HttpTransportBase
642
641
        self.transport_server = test_server.LocalURLServer
643
642
        self.transport_readonly_server = HttpServer
645
644
        url = self.get_readonly_url()
646
645
        url2 = self.get_readonly_url('foo/bar')
647
646
        # the transport returned may be any HttpTransportBase subclass
648
 
        t = get_transport(url)
649
 
        t2 = get_transport(url2)
 
647
        t = transport.get_transport(url)
 
648
        t2 = transport.get_transport(url2)
650
649
        self.failUnless(isinstance(t, HttpTransportBase))
651
650
        self.failUnless(isinstance(t2, HttpTransportBase))
652
651
        self.assertEqual(t2.base[:-1], t.abspath('foo/bar'))
690
689
class TestChrootedTest(tests.ChrootedTestCase):
691
690
 
692
691
    def test_root_is_root(self):
693
 
        from bzrlib.transport import get_transport
694
 
        t = get_transport(self.get_readonly_url())
 
692
        t = transport.get_transport(self.get_readonly_url())
695
693
        url = t.base
696
694
        self.assertEqual(url, t.clone('..').base)
697
695
 
2339
2337
            os.chdir = orig_chdir
2340
2338
        self.assertEqual(['foo', 'current'], chdirs)
2341
2339
 
 
2340
    def test_get_bzr_path_with_cwd_bzrlib(self):
 
2341
        self.get_source_path = lambda: ""
 
2342
        self.overrideAttr(os.path, "isfile", lambda path: True)
 
2343
        self.assertEqual(self.get_bzr_path(), "bzr")
 
2344
 
2342
2345
 
2343
2346
class TestActuallyStartBzrSubprocess(tests.TestCaseWithTransport):
2344
2347
    """Tests that really need to do things with an external bzr."""