Author: Armin Rigo <ar...@tunes.org>
Branch: cffi-embedding-win32
Changeset: r82129:6644cb289b26
Date: 2016-02-09 21:14 +0100
http://bitbucket.org/pypy/pypy/changeset/6644cb289b26/

Log:    Add pypy_init_embedded_cffi_module() to test_ztranslation

diff --git a/pypy/module/_cffi_backend/test/test_ztranslation.py 
b/pypy/module/_cffi_backend/test/test_ztranslation.py
--- a/pypy/module/_cffi_backend/test/test_ztranslation.py
+++ b/pypy/module/_cffi_backend/test/test_ztranslation.py
@@ -4,15 +4,18 @@
 
 # side-effect: FORMAT_LONGDOUBLE must be built before test_checkmodule()
 from pypy.module._cffi_backend import misc
-from pypy.module._cffi_backend import cffi1_module
+from pypy.module._cffi_backend import cffi1_module, embedding
 
 
 def test_checkmodule():
     # prepare_file_argument() is not working without translating the _file
     # module too
     def dummy_prepare_file_argument(space, fileobj):
-        # call load_cffi1_module() too, from a random place like here
-        cffi1_module.load_cffi1_module(space, "foo", "foo", 42)
+        # call pypy_init_embedded_cffi_module() from a random place like here
+        # --- this calls load_cffi1_module(), too
+        embedding.pypy_init_embedded_cffi_module(
+            rffi.cast(rffi.INT, embedding.EMBED_VERSION_MIN),
+            42)
         return lltype.nullptr(rffi.CCHARP.TO)
     old = ctypeptr.prepare_file_argument
     try:
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -397,9 +397,14 @@
             space.wrap(value)
 
 class FakeCompiler(object):
-    pass
+    def compile(self, code, name, mode, flags):
+        return FakePyCode()
 FakeObjSpace.default_compiler = FakeCompiler()
 
+class FakePyCode(W_Root):
+    def exec_code(self, space, w_globals, w_locals):
+        return W_Root()
+
 
 class FakeModule(W_Root):
     def __init__(self):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to