[pypy-commit] pypy default: Generalize the test to account for PyPy's particular behavior, which is subtly different from CPython's.

arigo noreply at buildbot.pypy.org
Fri Sep 26 11:22:43 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r73722:4e6dddc6d1ed
Date: 2014-09-26 11:22 +0200
http://bitbucket.org/pypy/pypy/changeset/4e6dddc6d1ed/

Log:	Generalize the test to account for PyPy's particular behavior, which
	is subtly different from CPython's.

diff --git a/lib-python/2.7/test/test_select.py b/lib-python/2.7/test/test_select.py
--- a/lib-python/2.7/test/test_select.py
+++ b/lib-python/2.7/test/test_select.py
@@ -57,7 +57,12 @@
                 del a[-1]
                 return sys.__stdout__.fileno()
         a[:] = [F()] * 10
-        self.assertEqual(select.select([], a, []), ([], a[:5], []))
+        result = select.select([], a, [])
+        # CPython: 'a' ends up with 5 items, because each fileno()
+        # removes an item and at the middle the iteration stops.
+        # PyPy: 'a' ends up empty, because the iteration is done on
+        # a copy of the original list: fileno() is called 10 times.
+        self.assert_(len(result[1]) <= 5)
 
 def test_main():
     test_support.run_unittest(SelectTestCase)


More information about the pypy-commit mailing list