Issue #11749: try to fix transient test_socket failure

This commit is contained in:
Antoine Pitrou 2011-04-04 01:22:06 +02:00
commit fc2e3763c8
1 changed files with 4 additions and 0 deletions

View File

@ -1411,6 +1411,10 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):
self.evt1.set()
self.evt2.wait(1.0)
first_seg = self.read_file.read(len(self.read_msg) - 3)
if first_seg is None:
# Data not arrived (can happen under Windows), wait a bit
time.sleep(0.5)
first_seg = self.read_file.read(len(self.read_msg) - 3)
buf = bytearray(10)
n = self.read_file.readinto(buf)
self.assertEqual(n, 3)