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

pedronis at codespeak.net pedronis at codespeak.net
Tue Jul 5 18:30:07 CEST 2005


Author: pedronis
Date: Tue Jul  5 18:30:06 2005
New Revision: 14301

Modified:
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/rpython/test/test_rbuiltin.py
Log:
limit ourself to just testing with os.getcwd wich should exist on Windows too.



Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Tue Jul  5 18:30:06 2005
@@ -27,13 +27,18 @@
 def ll_os_open(fname, mode):
     return os.open(''.join(fname.chars), mode)
 
-def ll_os_getuid():
-    return os.getuid()
+def ll_os_getcwd():
+    cwd = os.getcwd()
+    from pypy.rpython import rstr
+    p = rstr.malloc(rstr.STR, len(cwd))
+    for i in range(len(cwd)):
+        p.chars[i] = cwd[i]
+    return p
 
 def ll_os_dup(fd):
     return 999
 
 # external function declarations
 declare(os.open, int, ll_os_open, ll_annotable=False)
-declare(os.getuid, int, ll_os_getuid, ll_annotable=False)
+declare(os.getcwd, str, ll_os_getcwd, ll_annotable=False)
 declare(os.dup, int, ll_os_dup, ll_annotable=True)

Modified: pypy/dist/pypy/rpython/test/test_rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rbuiltin.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rbuiltin.py	Tue Jul  5 18:30:06 2005
@@ -76,11 +76,12 @@
             if op.opname == 'direct_call':
                 yield op
 
-def test_os_getuid():
+def test_os_getcwd():
     import os
     def fn():
-        return os.getuid()
-    assert interpret(fn, []) == fn()
+        return os.getcwd()
+    res = interpret(fn, []) 
+    assert ''.join(res.chars) == fn()
         
 def test_os_dup():
     import os



More information about the Pypy-commit mailing list