[pypy-svn] pypy default: Fix imp tests.

alex_gaynor commits-noreply at bitbucket.org
Wed Jan 19 17:26:44 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r40935:dde025102927
Date: 2011-01-19 10:00 -0600
http://bitbucket.org/pypy/pypy/changeset/dde025102927/

Log:	Fix imp tests.

diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py
--- a/pypy/module/imp/test/test_app.py
+++ b/pypy/module/imp/test/test_app.py
@@ -3,30 +3,24 @@
 class AppTestImpModule:
     def setup_class(cls):
         cls.w_imp = cls.space.getbuiltinmodule('imp')
+        cls.w_file_module = cls.space.wrap(__file__)
 
-        cls.w__py_file = cls.space.appexec(
-            [cls.space.wrap(__file__)], r"""(__file__):
-        def _py_file():
-            fn = __file__
-            if fn.lower().endswith('c') or fn.lower().endswith('o'):
-                fn = fn[:-1]
-            assert fn.lower().endswith('.py')
-            return fn
-        return _py_file""")
+    def w__py_file(self):
+        fn = self.file_module
+        if fn.lower().endswith('c') or fn.lower().endswith('o'):
+            fn = fn[:-1]
+        assert fn.lower().endswith('.py')
+        return fn
 
-        cls.w__pyc_file = cls.space.appexec([], r"""():
-        def _pyc_file():
-            import marshal, imp
-            co = compile("marker=42", "x.py", "exec")
-            f = open('@TEST.pyc', 'wb')
-            f.write(imp.get_magic())
-            f.write('\x00\x00\x00\x00')
-            marshal.dump(co, f)
-            f.close()
-            return '@TEST.pyc'
-        return _pyc_file""")
-
-
+    def w__pyc_file(self):
+        import marshal, imp
+        co = compile("marker=42", "x.py", "exec")
+        f = open('@TEST.pyc', 'wb')
+        f.write(imp.get_magic())
+        f.write('\x00\x00\x00\x00')
+        marshal.dump(co, f)
+        f.close()
+        return '@TEST.pyc'
 
     def test_find_module(self):
         import os


More information about the Pypy-commit mailing list