• Victor Stinner's avatar
    bpo-35347: Fix test_socket.NonBlockingTCPTests (GH-10791) (GH-10817) · dab59fa5
    Victor Stinner authored
    testAccept() and testRecv() of test_socket.NonBlockingTCPTests have a
    race condition: time.sleep() is used as a weak synchronization
    primitive and the tests fail randomly on slow buildbots.
    
    Use a reliable threading.Event to fix these tests.
    
    Other changes:
    
    * Replace send() with sendall()
    * Add a timeout to select() in testAccept() and testRecv()
    * Use addCleanup() to close sockets
    * Use assertRaises()
    
    (cherry picked from commit ebd5d6d6)
    dab59fa5
test_socket.py 63.1 KB