Author: Antonio Cuni <[email protected]>
Branch: hpy
Changeset: r98166:cf17a3d5456f
Date: 2019-11-28 01:45 +0100
http://bitbucket.org/pypy/pypy/changeset/cf17a3d5456f/

Log:    update the support machinery to take the new argument
        extra_templates; add test files for all the new hpy tests. Update
        the type declaration of HPyContext_s

diff --git a/pypy/module/hpy_universal/llapi.py 
b/pypy/module/hpy_universal/llapi.py
--- a/pypy/module/hpy_universal/llapi.py
+++ b/pypy/module/hpy_universal/llapi.py
@@ -56,18 +56,34 @@
     struct _HPy_s h_True;
     struct _HPy_s h_False;
     struct _HPy_s h_ValueError;
-    void *ctx_Module_Create;
-    void *ctx_Dup;
-    void *ctx_Close;
-    void *ctx_Long_FromLong;
-    void *ctx_Long_AsLong;
-    void *ctx_Arg_Parse;
-    void *ctx_Number_Add;
-    void *ctx_Unicode_FromString;
-    void *ctx_Err_SetString;
-    void *ctx_FromPyObject;
-    void *ctx_AsPyObject;
-    void *ctx_CallRealFunctionFromTrampoline;
+    struct _HPy_s h_TypeError;
+    void * ctx_Module_Create;
+    void * ctx_Dup;
+    void * ctx_Close;
+    void * ctx_Long_FromLong;
+    void * ctx_Long_FromLongLong;
+    void * ctx_Long_FromUnsignedLongLong;
+    void * ctx_Long_AsLong;
+    void * ctx_Float_FromDouble;
+    void * ctx_Arg_Parse;
+    void * ctx_Number_Add;
+    void * ctx_Err_SetString;
+    void * ctx_Bytes_Check;
+    void * ctx_Bytes_Size;
+    void * ctx_Bytes_GET_SIZE;
+    void * ctx_Bytes_AsString;
+    void * ctx_Bytes_AS_STRING;
+    void * ctx_Unicode_FromString;
+    void * ctx_Unicode_Check;
+    void * ctx_Unicode_AsUTF8String;
+    void * ctx_Unicode_FromWideChar;
+    void * ctx_List_New;
+    void * ctx_List_Append;
+    void * ctx_Dict_New;
+    void * ctx_Dict_SetItem;
+    void * ctx_FromPyObject;
+    void * ctx_AsPyObject;
+    void * ctx_CallRealFunctionFromTrampoline;
 } _struct_HPyContext_s;
 typedef struct _HPyContext_s *HPyContext;
 
diff --git a/pypy/module/hpy_universal/test/support.py 
b/pypy/module/hpy_universal/test/support.py
--- a/pypy/module/hpy_universal/test/support.py
+++ b/pypy/module/hpy_universal/test/support.py
@@ -1,7 +1,7 @@
 import py
 import pytest
 from rpython.tool.udir import udir
-from pypy.interpreter.gateway import interp2app, unwrap_spec
+from pypy.interpreter.gateway import interp2app, unwrap_spec, W_Root
 from pypy.module.hpy_universal.llapi import INCLUDE_DIR
 from pypy.module.hpy_universal._vendored.test import support as _support
 
@@ -26,9 +26,14 @@
                                                  keep=0)  # keep everything
         compiler = _support.ExtensionCompiler(tmpdir, 'universal', INCLUDE_DIR)
 
-        @unwrap_spec(source_template='text', name='text')
-        def descr_make_module(space, source_template, name='mytest'):
-            so_filename = compiler.compile_module(source_template, name)
+        @unwrap_spec(source_template='text', name='text', 
w_extra_templates=W_Root)
+        def descr_make_module(space, source_template, name='mytest',
+                              w_extra_templates=None):
+            if w_extra_templates is None:
+                extra_templates = ()
+            else:
+                import pdb;pdb.set_trace()
+            so_filename = compiler.compile_module(source_template, name, 
extra_templates)
             w_mod = space.appexec([space.newtext(so_filename), 
space.newtext(name)],
                 """(path, modname):
                     import hpy_universal
diff --git a/pypy/module/hpy_universal/test/test_bytesobject.py 
b/pypy/module/hpy_universal/test/test_bytesobject.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/hpy_universal/test/test_bytesobject.py
@@ -0,0 +1,6 @@
+import pytest
+from pypy.module.hpy_universal._vendored.test.test_bytesobject import 
TestBytesObject as _TestBytesobject
+from .support import HPyAppTest
+
+class AppTestBytesObject(HPyAppTest, _TestBytesObject):
+    spaceconfig = {'usemodules': ['hpy_universal']}
diff --git a/pypy/module/hpy_universal/test/test_cpy_compat.py 
b/pypy/module/hpy_universal/test/test_cpy_compat.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/hpy_universal/test/test_cpy_compat.py
@@ -0,0 +1,9 @@
+import pytest
+from pypy.module.hpy_universal._vendored.test.test_cpy_compat import 
TestCPythonCompatibility as _TestCPythonCompatibility
+from .support import HPyAppTest
+
+class AppTestUnicodeObject(HPyAppTest, _TestCPythonCompatibility):
+    spaceconfig = {'usemodules': ['hpy_universal']}
+
+    def setup_method(self, meth):
+        pytest.skip('IMPLEMENT ME')
diff --git a/pypy/module/hpy_universal/test/test_dictobject.py 
b/pypy/module/hpy_universal/test/test_dictobject.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/hpy_universal/test/test_dictobject.py
@@ -0,0 +1,6 @@
+import pytest
+from pypy.module.hpy_universal._vendored.test.test_dictobject import 
TestDictObject as _TestDictobject
+from .support import HPyAppTest
+
+class AppTestDictObject(HPyAppTest, _TestDictObject):
+    spaceconfig = {'usemodules': ['hpy_universal']}
diff --git a/pypy/module/hpy_universal/test/test_listobject.py 
b/pypy/module/hpy_universal/test/test_listobject.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/hpy_universal/test/test_listobject.py
@@ -0,0 +1,6 @@
+import pytest
+from pypy.module.hpy_universal._vendored.test.test_listobject import 
TestListObject as _TestListobject
+from .support import HPyAppTest
+
+class AppTestListObject(HPyAppTest, _TestListObject):
+    spaceconfig = {'usemodules': ['hpy_universal']}
diff --git a/pypy/module/hpy_universal/test/test_unicodeobject.py 
b/pypy/module/hpy_universal/test/test_unicodeobject.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/hpy_universal/test/test_unicodeobject.py
@@ -0,0 +1,6 @@
+import pytest
+from pypy.module.hpy_universal._vendored.test.test_unicodeobject import 
TestUnicodeObject as _TestUnicodeobject
+from .support import HPyAppTest
+
+class AppTestUnicodeObject(HPyAppTest, _TestUnicodeObject):
+    spaceconfig = {'usemodules': ['hpy_universal']}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to