Commits

Amaury Forgeot d'Arc committed ef3cb0c

With PyPy, builtin functions also have a __code__; check __code__.co_filename.
2.7 had the same tweak.

Comments (0)

Files changed (1)

lib-python/3.2/test/test_warnings.py

     # test.support.import_fresh_module utility function
     def test_accelerated(self):
         self.assertFalse(original_warnings is self.module)
-        self.assertFalse(hasattr(self.module.warn, '__code__'))
+        self.assertFalse(hasattr(self.module.warn, '__code__') and
+                         hasattr(self.module.warn.__code__, 'co_filename'))
 
 class PyWarnTests(BaseTest, WarnTests):
     module = py_warnings
     # test.support.import_fresh_module utility function
     def test_pure_python(self):
         self.assertFalse(original_warnings is self.module)
-        self.assertTrue(hasattr(self.module.warn, '__code__'))
+        self.assertTrue(hasattr(self.module.warn, '__code__') and
+                        hasattr(self.module.warn.__code__, 'co_filename'))
 
 
 class WCmdLineTests(unittest.TestCase):