~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-18 04:35:15 UTC
  • mfrom: (1666.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060418043515-cdbba05ac7d4b594
Fix race condition between end of stream and end of file with tuned_gzip.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.knit import KnitVersionedFile, \
29
29
     KnitAnnotateFactory
30
30
from bzrlib.tests import TestCaseWithTransport
 
31
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
31
32
from bzrlib.trace import mutter
32
33
from bzrlib.transport import get_transport
33
34
from bzrlib.transport.memory import MemoryTransport
783
784
            versionedfile.InterVersionedFile.unregister_optimiser(InterString)
784
785
        # now we should get the default InterVersionedFile object again.
785
786
        self.assertGetsDefaultInterVersionedFile(dummy_a, dummy_b)
 
787
 
 
788
 
 
789
class TestReadonlyHttpMixin(object):
 
790
 
 
791
    def test_readonly_http_works(self):
 
792
        # we should be able to read from http with a versioned file.
 
793
        vf = self.get_file()
 
794
        vf.add_lines('1', [], ['a\n'])
 
795
        vf.add_lines('2', ['1'], ['b\n', 'a\n'])
 
796
        readonly_vf = self.get_factory()('foo', get_transport(self.get_readonly_url('.')))
 
797
        for version in readonly_vf.versions():
 
798
            readonly_vf.get_lines(version)
 
799
 
 
800
 
 
801
class TestWeaveHTTP(TestCaseWithWebserver, TestReadonlyHttpMixin):
 
802
 
 
803
    def get_file(self):
 
804
        return WeaveFile('foo', get_transport(self.get_url('.')), create=True)
 
805
 
 
806
    def get_factory(self):
 
807
        return WeaveFile
 
808
 
 
809
 
 
810
class TestKnitHTTP(TestCaseWithWebserver, TestReadonlyHttpMixin):
 
811
 
 
812
    def get_file(self):
 
813
        return KnitVersionedFile('foo', get_transport(self.get_url('.')),
 
814
                                 delta=True, create=True)
 
815
 
 
816
    def get_factory(self):
 
817
        return KnitVersionedFile