Commits

Tobias Oberstein committed a701fa0

Make all unit tests pass.

Comments (0)

Files changed (2)

pypy/module/select/interp_kqueue.py

                 rffi.setintfield(timeout, 'c_tv_sec', sec)
                 rffi.setintfield(timeout, 'c_tv_nsec', nsec)
 
-            i = 0
-            for w_ev in space.listview(w_changelist):
-                ev = space.interp_w(W_Kevent, w_ev)
-                changelist[i].c_ident = ev.event.c_ident
-                changelist[i].c_filter = ev.event.c_filter
-                changelist[i].c_flags = ev.event.c_flags
-                changelist[i].c_fflags = ev.event.c_fflags
-                changelist[i].c_data = ev.event.c_data
-                changelist[i].c_udata = ev.event.c_udata
-                i += 1
+            if not space.is_w(w_changelist, space.w_None):
+                i = 0
+                for w_ev in space.listview(w_changelist):
+                    ev = space.interp_w(W_Kevent, w_ev)
+                    changelist[i].c_ident = ev.event.c_ident
+                    changelist[i].c_filter = ev.event.c_filter
+                    changelist[i].c_flags = ev.event.c_flags
+                    changelist[i].c_fflags = ev.event.c_fflags
+                    changelist[i].c_data = ev.event.c_data
+                    changelist[i].c_udata = ev.event.c_udata
+                    i += 1
 
             nfds = syscall_kevent(self.kqfd,
                                   changelist,

pypy/module/select/test/test_kqueue.py

+# adapted from CPython: Lib/test/test_kqueue.py
+
 import py
 import sys
 
         server_socket.listen(1)
         client = socket.socket()
         client.setblocking(False)
-        exc = raises(socket.error, client.connect, ("127.0.0.1", server_socket.getsockname()[1]))
-        assert exc.value.args[0] == errno.EINPROGRESS
+        try:
+            client.connect(("127.0.0.1", server_socket.getsockname()[1]))
+        except socket.error as e:
+            assert e.args[0] == errno.EINPROGRESS
+        else:
+            if sys.platform.startswith('freebsd'):
+                # FreeBSD doesn't raise an exception here
+                pass
+            else:
+                assert False, "EINPROGRESS not raised"
         server, addr = server_socket.accept()
 
         if sys.platform.startswith("darwin"):
             events = kq1.control(None, 4, 1)
             if len(events) == 4:
                 break
-            time.sleep(.1)
+            time.sleep(1.0)
         else:
             assert False, "timeout waiting for event notification"
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.