]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35347: Cleanup test_socket.NonBlockingTCPTests (GH-10818)
authorVictor Stinner <vstinner@redhat.com>
Fri, 30 Nov 2018 12:22:44 +0000 (13:22 +0100)
committerGitHub <noreply@github.com>
Fri, 30 Nov 2018 12:22:44 +0000 (13:22 +0100)
commit304315d251dbb4e85dd86056ba1925f25e646ca1
tree827d924992edc2522f0f816a0e88c5f1fdd06bc0
parentebd5d6d6e6e4e751ba9c7534004aadfc27ba9265
bpo-35347: Cleanup test_socket.NonBlockingTCPTests (GH-10818)

* Replace testInheritFlags() with two tests:
  testInheritFlagsBlocking() and testInheritFlagsTimeout()
  to test different default socket timeout. Moreover, the test now
  checks sock.gettimeout() rather than a functional test on recv().
* Replace time.time() with time.monotonic()
* Add socket_setdefaulttimeout() context manager to restore the
  default timeout when the test completes.
* Remove testConnect(): accept() wasn't blocking and testAccept()
  already tests non-blocking accept().
* Remove accept() functional test from testInitNonBlocking():
  already tested by testAccept()
* Rewrite testSetBlocking() with a new assert_sock_timeout() method
* Use addCleanup() and context manager to close sockets
* Replace assertTrue(x < y) with assertLess(x, y)
Lib/test/test_socket.py