[pypy-commit] pypy default: merge

fijal noreply at buildbot.pypy.org
Mon Oct 29 12:19:32 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r58581:e5c85f97583f
Date: 2012-10-29 12:19 +0100
http://bitbucket.org/pypy/pypy/changeset/e5c85f97583f/

Log:	merge

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
@@ -2,7 +2,7 @@
 
 class AppTestItertools:
     def setup_class(cls):
-        cls.space = gettestobjspace()
+        cls.space = gettestobjspace(usemodules=['itertools'])
         cls.w_itertools = cls.space.appexec([], "(): import itertools; return itertools")
 
     def test_chain(self):
diff --git a/pypy/module/test_lib_pypy/test_pwd.py b/pypy/module/test_lib_pypy/test_pwd.py
--- a/pypy/module/test_lib_pypy/test_pwd.py
+++ b/pypy/module/test_lib_pypy/test_pwd.py
@@ -5,7 +5,8 @@
     def setup_class(cls):
         if sys.platform == 'win32':
             py.test.skip("Unix only")
-        cls.space = gettestobjspace(usemodules=('_ffi', '_rawffi'))
+        cls.space = gettestobjspace(usemodules=('_ffi', '_rawffi',
+                                                'itertools'))
         cls.space.appexec((), "(): import pwd")
 
     def test_getpwuid(self):
diff --git a/pypy/module/zipimport/test/test_undocumented.py b/pypy/module/zipimport/test/test_undocumented.py
--- a/pypy/module/zipimport/test/test_undocumented.py
+++ b/pypy/module/zipimport/test/test_undocumented.py
@@ -19,7 +19,8 @@
 
 class AppTestZipImport:
     def setup_class(cls):
-        space = gettestobjspace(usemodules=['zipimport', 'rctime', 'struct'])
+        space = gettestobjspace(usemodules=['zipimport', 'rctime', 'struct',
+                                            'itertools'])
         cls.space = space
         cls.w_created_paths = space.wrap(created_paths)
     
diff --git a/pypy/module/zipimport/test/test_zipimport.py b/pypy/module/zipimport/test/test_zipimport.py
--- a/pypy/module/zipimport/test/test_zipimport.py
+++ b/pypy/module/zipimport/test/test_zipimport.py
@@ -46,11 +46,10 @@
             return __file__
         """).compile()
 
+        usemodules = ['zipimport', 'rctime', 'struct', 'itertools']
         if cls.compression == ZIP_DEFLATED:
-            space = gettestobjspace(usemodules=['zipimport', 'zlib', 'rctime', 'struct'])
-        else:
-            space = gettestobjspace(usemodules=['zipimport', 'rctime', 'struct'])
-            
+            usemodules.append('zlib')
+        space = gettestobjspace(usemodules=usemodules)
         cls.space = space
         tmpdir = udir.ensure('zipimport_%s' % cls.__name__, dir=1)
         now = time.time()
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])
diff --git a/pypy/objspace/std/test/test_methodcache.py b/pypy/objspace/std/test/test_methodcache.py
--- a/pypy/objspace/std/test/test_methodcache.py
+++ b/pypy/objspace/std/test/test_methodcache.py
@@ -206,8 +206,3 @@
             setattr(a, "a%s" % i, i)
         cache_counter = __pypy__.method_cache_counter("x")
         assert cache_counter[0] == 0 # 0 hits, because all the attributes are new
-
-    def test_get_module_from_namedtuple(self):
-        # this used to crash
-        from collections import namedtuple
-        assert namedtuple("a", "b").__module__
diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1063,6 +1063,21 @@
         A.__dict__['x'] = 5
         assert A.x == 5
 
+
+class AppTestWithMethodCacheCounter:
+    def setup_class(cls):
+        cls.space = gettestobjspace(
+            **{"objspace.std.withmethodcachecounter": True})
+
+    def test_module_from_handbuilt_type(self):
+        d = {'tuple': tuple, '__name__': 'foomod'}
+        exec """class foo(tuple): pass""" in d
+        t = d['foo']
+        t.__module__ = 'barmod'
+        # this last line used to crash; see ab926f846f39
+        assert t.__module__
+
+
 class AppTestMutableBuiltintypes:
 
     def setup_class(cls):


More information about the pypy-commit mailing list