[Python-Dev] Now test_socket fails

Michael Gilfix mgilfix@eecs.tufts.edu
Wed, 31 Jul 2002 13:37:11 -0400


  I'm pretty sure that qualifies as a bug. The problem exists on linux
as well (as a fresh cvs update has shown). In general though, the
socket call should always take the two arguments.

  It seems at one point that the 2.3 version of the socket module accepted
erroneously just a socket() call, while 2.2 does not. It seems Guido
added these lines to integrate default timeout testing. If someone with
write priveleges can just fix that to read:

  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

  that should fix the problem.

                      -- Mike

On Wed, Jul 31 @ 13:26, Tim Peters wrote:
> What's socket.socket() supposed to do without any arguments?  Can't work on
> Windows, because socket.py has
> 
> if (sys.platform.lower().startswith("win")
>     or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")
>     or sys.platform=="riscos"):
> 
>     _realsocketcall = _socket.socket
> 
>     def socket(family, type, proto=0):
>         return _socketobject(_realsocketcall(family, type, proto))
> 
> 
> C:\Code\python\PCbuild>python ../lib/test/test_socket.py
> Testing for mission critical constants. ... ok
> Testing default timeout. ... ERROR
> Testing getservbyname(). ... ok
> Testing getsockopt(). ... ok
> Testing hostname resolution mechanisms. ... ok
> Making sure getnameinfo doesn't crash the interpreter. ... ok
> testNtoH (__main__.GeneralModuleTests) ... ok
> Testing reference count for getnameinfo. ... ok
> testing send() after close() with timeout. ... ok
> Testing setsockopt(). ... ok
> Testing getsockname(). ... ok
> Testing that socket module exceptions. ... ok
> Testing fromfd(). ... ok
> Testing receive in chunks over TCP. ... ok
> Testing recvfrom() in chunks over TCP. ... ok
> Testing large receive over TCP. ... ok
> Testing large recvfrom() over TCP. ... ok
> Testing sendall() with a 2048 byte string over TCP. ... ok
> Testing shutdown(). ... ok
> Testing recvfrom() over UDP. ... ok
> Testing sendto() and Recv() over UDP. ... ok
> Testing non-blocking accept. ... ok
> Testing non-blocking connect. ... ok
> Testing non-blocking recv. ... ok
> Testing whether set blocking works. ... ok
> Performing file readline test. ... ok
> Performing small file read test. ... ok
> Performing unbuffered file read test. ... ok
> 
> ======================================================================
> ERROR: Testing default timeout.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "../lib/test/test_socket.py", line 273, in testDefaultTimeout
>     s = socket.socket()
> TypeError: socket() takes at least 2 arguments (0 given)
> 
> ----------------------------------------------------------------------
> Ran 28 tests in 3.190s
> 
> FAILED (errors=1)
> Traceback (most recent call last):
>   File "../lib/test/test_socket.py", line 559, in ?
>     test_main()
>   File "../lib/test/test_socket.py", line 556, in test_main
>     test_support.run_suite(suite)
>   File "C:\CODE\PYTHON\lib\test\test_support.py", line 188, in run_suite
>     raise TestFailed(err)
> test.test_support.TestFailed: Traceback (most recent call last):
>   File "../lib/test/test_socket.py", line 273, in testDefaultTimeout
>     s = socket.socket()
> TypeError: socket() takes at least 2 arguments (0 given)
> 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
`-> (tim.one)

-- 
Michael Gilfix
mgilfix@eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html