[pypy-svn] r74256 - pypy/trunk/pypy/module/cpyext/test

exarkun at codespeak.net exarkun at codespeak.net
Fri Apr 30 00:55:28 CEST 2010


Author: exarkun
Date: Fri Apr 30 00:55:26 2010
New Revision: 74256

Added:
   pypy/trunk/pypy/module/cpyext/test/banana.c
Modified:
   pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
Log:
A (skipped) failing test for packages with extension modules in them that do not use their fully qualified name with Py_InitModule

Added: pypy/trunk/pypy/module/cpyext/test/banana.c
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/cpyext/test/banana.c	Fri Apr 30 00:55:26 2010
@@ -0,0 +1,10 @@
+#include "Python.h"
+
+static PyMethodDef banana_functions[] = {
+    {NULL, NULL}
+};
+
+void initbanana(void)
+{
+    Py_InitModule("banana", banana_functions);
+}

Modified: pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_cpyext.py	(original)
+++ pypy/trunk/pypy/module/cpyext/test/test_cpyext.py	Fri Apr 30 00:55:26 2010
@@ -332,6 +332,17 @@
         assert module.__name__ == expected_name
 
 
+    def test_InitModuleInPackage(self):
+        """
+        If `apple.banana` is an extension module which calls Py_InitModule4 with
+        only "banana" as a name, the resulting module nevertheless is stored at
+        `sys.modules["apple.banana"]`.
+        """
+        skip("About to implement this")
+        module = self.import_module(name="apple.banana", filename="banana")
+        assert module.__name__ == "apple.banana"
+
+
     def test_modinit_func(self):
         """
         A module can use the PyMODINIT_FUNC macro to declare or define its



More information about the Pypy-commit mailing list