~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-05 10:27:33 UTC
  • mto: (5008.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5009.
  • Revision ID: v.ladeuil+lp@free.fr-20100205102733-8wpjnqz6g4nvrbfu
All Conflict action method names start with 'action_' to avoid potential namespace collisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1039
1039
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1040
1040
        repo = self.make_repository('repo', format='dirstate-with-subtree')
1041
1041
        bundle.install_revisions(repo)
1042
 
        inv_text = repo.get_inventory_xml('rev2')
 
1042
        inv_text = repo._get_inventory_xml('rev2')
1043
1043
        self.assertNotContainsRe(inv_text, 'format="5"')
1044
1044
        self.assertContainsRe(inv_text, 'format="7"')
1045
1045
 
1065
1065
 
1066
1066
    def test_inv_hash_across_serializers(self):
1067
1067
        repo = self.make_repo_with_installed_revisions()
1068
 
        recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
1069
 
        xml = repo.get_inventory_xml('rev2')
 
1068
        recorded_inv_sha1 = repo.get_revision('rev2').inventory_sha1
 
1069
        xml = repo._get_inventory_xml('rev2')
1070
1070
        self.assertEqual(osutils.sha_string(xml), recorded_inv_sha1)
1071
1071
 
1072
1072
    def test_across_models_incompatible(self):
1820
1820
            def look_up(self, name, url):
1821
1821
                return 'source'
1822
1822
        directories.register('foo:', FooService, 'Testing directory service')
1823
 
        self.addCleanup(lambda: directories.remove('foo:'))
 
1823
        self.addCleanup(directories.remove, 'foo:')
1824
1824
        self.build_tree_contents([('./foo:bar', out.getvalue())])
1825
1825
        self.assertRaises(errors.NotABundle, read_mergeable_from_url,
1826
1826
                          'foo:bar')
1850
1850
class _DisconnectingTCPServer(object):
1851
1851
    """A TCP server that immediately closes any connection made to it."""
1852
1852
 
1853
 
    def setUp(self):
 
1853
    def start_server(self):
1854
1854
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1855
1855
        self.sock.bind(('127.0.0.1', 0))
1856
1856
        self.sock.listen(1)
1868
1868
    def get_url(self):
1869
1869
        return 'bzr://127.0.0.1:%d/' % (self.port,)
1870
1870
 
1871
 
    def tearDown(self):
 
1871
    def stop_server(self):
1872
1872
        try:
1873
1873
            # make sure the thread dies by connecting to the listening socket,
1874
1874
            # just in case the test failed to do so.
1879
1879
            pass
1880
1880
        self.sock.close()
1881
1881
        self.thread.join()
1882