~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2012-09-11 08:39:14 UTC
  • mfrom: (6437.63.8 2.5)
  • mto: (6437.63.9 2.5)
  • mto: This revision was merged to the branch mainline in revision 6563.
  • Revision ID: john@arbash-meinel.com-20120911083914-j35o15f848xkl34n
Merge 2.5 including the other osutils.send_all fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
839
839
            self.assertRaises(errors.ConnectionReset,
840
840
                osutils.send_all, sock, 'some more content')
841
841
 
 
842
    def test_send_with_no_progress(self):
 
843
        # See https://bugs.launchpad.net/bzr/+bug/1047309
 
844
        # It seems that paramiko can get into a state where it doesn't error,
 
845
        # but it returns 0 bytes sent for requests over and over again.
 
846
        class NoSendingSocket(object):
 
847
            def __init__(self):
 
848
                self.call_count = 0
 
849
            def send(self, bytes):
 
850
                self.call_count += 1
 
851
                if self.call_count > 100:
 
852
                    # Prevent the test suite from hanging
 
853
                    raise RuntimeError('too many calls')
 
854
                return 0
 
855
        sock = NoSendingSocket()
 
856
        self.assertRaises(errors.ConnectionReset,
 
857
                          osutils.send_all, sock, 'content')
 
858
        self.assertEqual(1, sock.call_count)
 
859
 
 
860
 
842
861
class TestPosixFuncs(tests.TestCase):
843
862
    """Test that the posix version of normpath returns an appropriate path
844
863
       when used with 2 leading slashes."""