[pypy-commit] pypy default: Attempt to fix this test to check with a valid fd.

arigo noreply at buildbot.pypy.org
Thu Nov 10 11:54:16 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49122:0f4680451831
Date: 2011-11-10 11:53 +0100
http://bitbucket.org/pypy/pypy/changeset/0f4680451831/

Log:	Attempt to fix this test to check with a valid fd.

diff --git a/pypy/module/select/test/test_select.py b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -214,11 +214,15 @@
 
     def test_poll(self):
         import select
-        class A(object):
-            def __int__(self):
-                return 3
-        
-        select.poll().poll(A()) # assert did not crash
+        readend, writeend = self.getpair()
+        try:
+            class A(object):
+                def __int__(self):
+                    return readend.fileno()
+            select.poll().poll(A()) # assert did not crash
+        finally:
+            readend.close()
+            writeend.close()
 
 class AppTestSelectWithPipes(_AppTestSelect):
     "Use a pipe to get pairs of file descriptors"


More information about the pypy-commit mailing list