Skip to content

bpo-35347: Cleanup test_socket.NonBlockingTCPTests#10818

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:cleanup_test_socket
Nov 30, 2018
Merged

bpo-35347: Cleanup test_socket.NonBlockingTCPTests#10818
vstinner merged 1 commit into
python:masterfrom
vstinner:cleanup_test_socket

Conversation

@vstinner
Copy link
Copy Markdown
Member

@vstinner vstinner commented Nov 30, 2018

  • 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)

https://bugs.python.org/issue35347

* 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)
@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting merge labels Nov 30, 2018
@vstinner vstinner merged commit 304315d into python:master Nov 30, 2018
@vstinner vstinner deleted the cleanup_test_socket branch November 30, 2018 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants