~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: Robert Collins
  • Date: 2007-08-27 04:19:49 UTC
  • mto: (2592.3.117 repository)
  • mto: This revision was merged to the branch mainline in revision 2885.
  • Revision ID: robertc@robertcollins.net-20070827041949-br263tkuxayldxoc
* ``bzrlib.transport.Transport.put_file`` now returns the number of bytes
  put by the method call, to allow avoiding stat-after write or
  housekeeping in callers. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
374
374
                    t.put_file, 'a', StringIO('some text for a\n'))
375
375
            return
376
376
 
377
 
        t.put_file('a', StringIO('some text for a\n'))
 
377
        result = t.put_file('a', StringIO('some text for a\n'))
 
378
        # put_file returns the length of the data written
 
379
        self.assertEqual(16, result)
378
380
        self.failUnless(t.has('a'))
379
381
        self.check_transport_contents('some text for a\n', t, 'a')
380
382
        # Put also replaces contents
381
 
        t.put_file('a', StringIO('new\ncontents for\na\n'))
 
383
        result = t.put_file('a', StringIO('new\ncontents for\na\n'))
 
384
        self.assertEqual(19, result)
382
385
        self.check_transport_contents('new\ncontents for\na\n', t, 'a')
383
386
        self.assertRaises(NoSuchFile,
384
387
                          t.put_file, 'path/doesnt/exist/c',