mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
testSetSockOpt() should not require the reuse flag to be 1 -- any
nonzero value is OK. Also fixed the error message for this and for testGetSockOpt().
This commit is contained in:
parent
7648968716
commit
733632ac1f
1 changed files with 2 additions and 2 deletions
|
@ -253,14 +253,14 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
# We know a socket should start without reuse==0
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
reuse = sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
||||
self.assert_(reuse == 0, "Error performing getsockopt.")
|
||||
self.failIf(reuse != 0, "initial mode is reuse")
|
||||
|
||||
def testSetSockOpt(self):
|
||||
"""Testing setsockopt()."""
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
reuse = sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
||||
self.assert_(reuse == 1, "Error performing setsockopt.")
|
||||
self.failIf(reuse == 0, "failed to set reuse mode")
|
||||
|
||||
class BasicTCPTest(SocketConnectedTest):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue