[pypy-commit] pypy cleanup-test_lib_pypy: Convert test_itertools to regular (app-level) tests; the issue on CPython was fixed long ago

rlamy pypy.commits at gmail.com
Thu Dec 6 12:32:20 EST 2018


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: cleanup-test_lib_pypy
Changeset: r95431:213df22b47c7
Date: 2018-12-06 17:30 +0000
http://bitbucket.org/pypy/pypy/changeset/213df22b47c7/

Log:	Convert test_itertools to regular (app-level) tests; the issue on
	CPython was fixed long ago

diff --git a/pypy/module/test_lib_pypy/test_itertools.py b/pypy/module/test_lib_pypy/test_itertools.py
--- a/pypy/module/test_lib_pypy/test_itertools.py
+++ b/pypy/module/test_lib_pypy/test_itertools.py
@@ -1,22 +1,15 @@
-class AppTestItertools:
-    spaceconfig = dict(usemodules=['itertools'])
+import sys
+import itertools
 
-    def setup_class(cls):
-        cls.w_itertools = cls.space.appexec([], "(): import itertools; return itertools")
+def test_chain():
+    it = itertools.chain([], [1, 2, 3])
+    lst = list(it)
+    assert lst == [1, 2, 3]
 
-    def test_chain(self):
-        it = self.itertools.chain([], [1, 2, 3])
-        lst = list(it)
-        assert lst == [1, 2, 3]
+def test_islice_maxint():
+    slic = itertools.islice(itertools.count(), 1, 10, sys.maxint)
+    assert len(list(slic)) == 1
 
-    def test_islice(self):
-        import sys
-        itertools = self.itertools
-
-        slic = itertools.islice(itertools.count(), 1, 10, sys.maxint)
-        assert len(list(slic)) == 1
-
-        if '__pypy__' not in sys.builtin_module_names:
-            skip("this takes ages on top of CPython's itertools module")
-        slic = itertools.islice(itertools.count(), 1, 10, sys.maxint-20)
-        assert len(list(slic)) == 1
+def test_islice_largeint():
+    slic = itertools.islice(itertools.count(), 1, 10, sys.maxint - 20)
+    assert len(list(slic)) == 1


More information about the pypy-commit mailing list