Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r70873:8ec8f81297a1
Date: 2014-04-22 13:38 -0700
http://bitbucket.org/pypy/pypy/changeset/8ec8f81297a1/

Log:    socket errors have errno on win32

diff --git a/rpython/rlib/test/test_rsocket.py 
b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -3,11 +3,6 @@
 from rpython.rlib.rsocket import *
 import socket as cpy_socket
 
-# cannot test error codes in Win32 because ll2ctypes doesn't save
-# the errors that WSAGetLastError() should return, making it likely
-# that other operations stamped on it inbetween.
-errcodesok = sys.platform != 'win32'
-
 def setup_module(mod):
     rsocket_startup()
 
@@ -257,14 +252,12 @@
     assert addr.eq(sock.getsockname())
     sock.listen(1)
     err = py.test.raises(CSocketError, sock.accept)
-    if errcodesok:
-        assert err.value.errno in (errno.EAGAIN, errno.EWOULDBLOCK)
+    assert err.value.errno in (errno.EAGAIN, errno.EWOULDBLOCK)
 
     s2 = RSocket(AF_INET, SOCK_STREAM)
     s2.setblocking(False)
     err = py.test.raises(CSocketError, s2.connect, addr)
-    if errcodesok:
-        assert err.value.errno in (errno.EINPROGRESS, errno.EWOULDBLOCK)
+    assert err.value.errno in (errno.EINPROGRESS, errno.EWOULDBLOCK)
 
     fd1, addr2 = sock.accept()
     s1 = RSocket(fd=fd1)
@@ -274,8 +267,7 @@
     assert addr2.eq(s1.getpeername())
 
     err = s2.connect_ex(addr)   # should now work
-    if errcodesok:
-        assert err in (0, errno.EISCONN)
+    assert err in (0, errno.EISCONN)
 
     s1.send('?')
     import time
@@ -283,8 +275,7 @@
     buf = s2.recv(100)
     assert buf == '?'
     err = py.test.raises(CSocketError, s1.recv, 5000)
-    if errcodesok:
-        assert err.value.errno in (errno.EAGAIN, errno.EWOULDBLOCK)
+    assert err.value.errno in (errno.EAGAIN, errno.EWOULDBLOCK)
     count = s2.send('x'*50000)
     assert 1 <= count <= 50000
     while count: # Recv may return less than requested
@@ -343,8 +334,7 @@
 def test_connect_ex():
     s = RSocket()
     err = s.connect_ex(INETAddress('0.0.0.0', 0))   # should not work
-    if errcodesok:
-        assert err in (errno.ECONNREFUSED, errno.EADDRNOTAVAIL)
+    assert err in (errno.ECONNREFUSED, errno.EADDRNOTAVAIL)
     s.close()
 
 def test_connect_with_timeout_fail():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to