[pypy-svn] r28831 - in pypy/dist/pypy: interpreter module/readline/test

arigo at codespeak.net arigo at codespeak.net
Thu Jun 15 17:41:37 CEST 2006


Author: arigo
Date: Thu Jun 15 17:41:36 2006
New Revision: 28831

Added:
   pypy/dist/pypy/module/readline/test/test_compiled.py   (contents, props changed)
   pypy/dist/pypy/module/readline/test/test_mixedmodule.py   (contents, props changed)
   pypy/dist/pypy/module/readline/test/test_with_pypy.py
      - copied, changed from r28830, pypy/dist/pypy/module/readline/test/test_readline.py
Removed:
   pypy/dist/pypy/module/readline/test/test_readline.py
Modified:
   pypy/dist/pypy/interpreter/mixedmodule.py
   pypy/dist/pypy/module/readline/test/test_c_readline.py
Log:
Add examples of the various ways to test a MixedModule.


Modified: pypy/dist/pypy/interpreter/mixedmodule.py
==============================================================================
--- pypy/dist/pypy/interpreter/mixedmodule.py	(original)
+++ pypy/dist/pypy/interpreter/mixedmodule.py	Thu Jun 15 17:41:36 2006
@@ -201,3 +201,8 @@
     res.__dict__.update(moddict)
     sys.modules[appname] = res
     return res
+
+def compilemodule(name, interactive=False):
+    "Compile a PyPy module for CPython."
+    from pypy.rpython.rctypes.tool.compilemodule import compilemodule
+    return compilemodule(name, interactive=interactive)

Modified: pypy/dist/pypy/module/readline/test/test_c_readline.py
==============================================================================
--- pypy/dist/pypy/module/readline/test/test_c_readline.py	(original)
+++ pypy/dist/pypy/module/readline/test/test_c_readline.py	Thu Jun 15 17:41:36 2006
@@ -1,5 +1,9 @@
+"""
+Directly test the basic ctypes wrappers.
+"""
 
 from pypy.module.readline import c_readline 
 
+
 def test_basic_import():
     c_readline.c_rl_initialize()

Added: pypy/dist/pypy/module/readline/test/test_compiled.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/module/readline/test/test_compiled.py	Thu Jun 15 17:41:36 2006
@@ -0,0 +1,14 @@
+"""
+Test the compilation of the readline mixedmodule to a CPython extension
+module.
+"""
+
+from pypy.interpreter.mixedmodule import compilemodule
+
+
+def setup_module(mod):
+    mod.readline = compilemodule("readline")
+
+def test_names():
+    assert readline.__name__ == 'readline'
+    assert hasattr(readline, 'readline')

Added: pypy/dist/pypy/module/readline/test/test_mixedmodule.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/module/readline/test/test_mixedmodule.py	Thu Jun 15 17:41:36 2006
@@ -0,0 +1,14 @@
+"""
+Tests for the mixedmodule interface.  The following tests run on top
+of CPython, without using the PyPy interpreter.
+"""
+
+from pypy.interpreter.mixedmodule import testmodule
+
+
+def setup_module(mod):
+    mod.readline = testmodule("readline")
+
+def test_names():
+    assert readline.__name__ == 'readline'
+    assert hasattr(readline, 'readline')



More information about the Pypy-commit mailing list