Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r58570:a049983c8899
Date: 2012-10-29 11:14 +0100
http://bitbucket.org/pypy/pypy/changeset/a049983c8899/

Log:    Don't import 'collections' but only '_collections' or '_abcoll' from
        here. 'collections' imports the world, including itertools.

diff --git a/pypy/objspace/std/test/test_iterobject.py 
b/pypy/objspace/std/test/test_iterobject.py
--- a/pypy/objspace/std/test/test_iterobject.py
+++ b/pypy/objspace/std/test/test_iterobject.py
@@ -68,7 +68,7 @@
         raises(TypeError, len, iter(iterable))
         
     def test_no_len_on_deque_iter(self):
-        from collections import deque
+        from _collections import deque
         iterable = deque([1,2,3,4])
         raises(TypeError, len, iter(iterable))
 
@@ -81,15 +81,14 @@
         it = reversed([5,6,7])
         raises(TypeError, len, it)
 
-    def test_no_len_on_UserList_iter(self):
+    def test_no_len_on_UserList_iter_reversed(self):
+        import sys, _abcoll
+        sys.modules['collections'] = _abcoll
         from UserList import UserList
         iterable = UserList([1,2,3,4])
         raises(TypeError, len, iter(iterable))
-
-    def test_no_len_on_UserList_reversed(self):
-        from UserList import UserList
-        iterable = UserList([1,2,3,4])
         raises(TypeError, len, reversed(iterable))
+        del sys.modules['collections']
 
     def test_no_len_on_set_iter(self):
         iterable = set([1,2,3,4])
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to