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

Log:    Move the test to an "expected" place and don't import 'collections'
        at app-level.

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):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to