[pypy-svn] r44211 - in pypy/branch/kill-ctypes/pypy/rpython/module: . test

fijal at codespeak.net fijal at codespeak.net
Tue Jun 12 23:22:30 CEST 2007


Author: fijal
Date: Tue Jun 12 23:22:30 2007
New Revision: 44211

Modified:
   pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
   pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py
   pypy/branch/kill-ctypes/pypy/rpython/module/test/test_posix.py
Log:
Fix tests and provide some fake implementations.


Modified: pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	Tue Jun 12 23:22:30 2007
@@ -56,7 +56,9 @@
     name = '_dup'
 else:
     name = 'dup'
-os_dup = rffi.llexternal(name, [lltype.Signed], lltype.Signed)
+
+os_dup = rffi.llexternal(name, [lltype.Signed], lltype.Signed,
+                         _callable=os.dup)
 
 def dup_lltypeimpl(fd):
     newfd = os_dup(fd)
@@ -110,8 +112,12 @@
 register_external(ros.utime_tuple, [str, (int, int)], s_None, "ll_os.utime_tuple",
                   llimpl=utime_tuple_lltypeimpl)    
 
+def fake_os_open(l_path, flags, mode):
+    path = rffi.charp2str(l_path)
+    return os.open(path, flags, mode)
+
 os_open = rffi.llexternal('open', [rffi.CCHARP, lltype.Signed, rffi.MODE_T],
-                          lltype.Signed)
+                          lltype.Signed, _callable=fake_os_open)
 
 def os_open_lltypeimpl(path, flags, mode):
     l_path = rffi.str2charp(path)
@@ -120,6 +126,7 @@
     if result == -1:
         raise OSError(rffi.c_errno, "os_open failed")
     return result
+
 register_external(os.open, [str, int, int], int, "ll_os.open",
                   llimpl=os_open_lltypeimpl)
 

Modified: pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/test/test_ll_os.py	Tue Jun 12 23:22:30 2007
@@ -57,11 +57,12 @@
 test_src = """
 import os
 from pypy.tool.udir import udir
-from pypy.rpython.lltypesystem.module.ll_os import Implementation as impl
+#from pypy.rpython.module.ll_os import 
 
 def test_environ():
     count = 0
     while 1:
+        l
         if not impl.ll_os_environ(count):
             break
         count += 1
@@ -71,6 +72,7 @@
 
 def test_environ():
     import py
+    py.test.skip("Test hangs, should be rewritten to new-style")
     gw = py.execnet.PopenGateway()
     chan = gw.remote_exec(py.code.Source(test_src))
     res = chan.receive()

Modified: pypy/branch/kill-ctypes/pypy/rpython/module/test/test_posix.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/test/test_posix.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/test/test_posix.py	Tue Jun 12 23:22:30 2007
@@ -19,6 +19,7 @@
         testfile.close()
 
     def test_open(self):
+        self._skip_oo('os.open oo fake impl')
         def f():
             ff = posix.open(path,posix.O_RDONLY,0777)
             return ff



More information about the Pypy-commit mailing list