~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
 
18
18
from cStringIO import StringIO
 
19
import os
19
20
import subprocess
20
21
import sys
21
22
import threading
722
723
        self.assertEquals(t.local_abspath(''), here)
723
724
 
724
725
 
 
726
class TestLocalTransportWriteStream(tests.TestCaseWithTransport):
 
727
 
 
728
    def test_local_fdatasync_calls_fdatasync(self):
 
729
        """Check fdatasync on a stream tries to flush the data to the OS.
 
730
        
 
731
        We can't easily observe the external effect but we can at least see
 
732
        it's called.
 
733
        """
 
734
        t = self.get_transport('.')
 
735
        calls = self.recordCalls(os, 'fdatasync')
 
736
        w = t.open_write_stream('out')
 
737
        w.write('foo')
 
738
        w.fdatasync()
 
739
        with open('out', 'rb') as f:
 
740
            # Should have been flushed.
 
741
            self.assertEquals(f.read(), 'foo')
 
742
        self.assertEquals(len(calls), 1, calls)
 
743
 
 
744
 
725
745
class TestWin32LocalTransport(tests.TestCase):
726
746
 
727
747
    def test_unc_clone_to_root(self):