[pypy-svn] r22526 - in pypy/dist/pypy/rpython/rctypes: . test

stephan at codespeak.net stephan at codespeak.net
Mon Jan 23 15:54:32 CET 2006


Author: stephan
Date: Mon Jan 23 15:54:30 2006
New Revision: 22526

Added:
   pypy/dist/pypy/rpython/rctypes/
   pypy/dist/pypy/rpython/rctypes/__init__.py
   pypy/dist/pypy/rpython/rctypes/interface.py
   pypy/dist/pypy/rpython/rctypes/test/
   pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
Log:
added first tests for rctypes implementation. Only DUMMY code at the moment.

Added: pypy/dist/pypy/rpython/rctypes/__init__.py
==============================================================================

Added: pypy/dist/pypy/rpython/rctypes/interface.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/rctypes/interface.py	Mon Jan 23 15:54:30 2006
@@ -0,0 +1,3 @@
+from ctypes import *
+
+

Added: pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py	Mon Jan 23 15:54:30 2006
@@ -0,0 +1,22 @@
+import py.test
+
+def setup_module(mod):
+    try:
+        import ctypes
+    except ImportError:
+        py.test.skip("this test needs ctypes installed")
+
+class Test_rctypes:
+    def test_simple(self):
+        from pypy.rpython.rctypes.interface import windll, c_char_p
+
+        import sys
+        if sys.platform == 'win32':
+            py.test.raises(WindowsError,"windll.LoadLibrary('kernel42.dll')")
+            mylib = windll.LoadLibrary('kernel32.dll')
+            gcl = mylib.GetCommandLineA
+            gcl.restype = c_char_p
+            def tst():
+               return gcl()
+            res = tst()   
+            assert isinstance(res, str)



More information about the Pypy-commit mailing list