[pypy-svn] r16690 - in pypy/release/0.7.x/pypy: interpreter module/posix/test rpython/module/test

tismer at codespeak.net tismer at codespeak.net
Fri Aug 26 21:17:23 CEST 2005


Author: tismer
Date: Fri Aug 26 21:17:17 2005
New Revision: 16690

Modified:
   pypy/release/0.7.x/pypy/interpreter/baseobjspace.py
   pypy/release/0.7.x/pypy/module/posix/test/test_posix2.py
   pypy/release/0.7.x/pypy/rpython/module/test/test_posix.py
Log:
made the import os posix create the right name,
as it appears in "os.name".
Disabled a test of ftruncate for windows.

Modified: pypy/release/0.7.x/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/release/0.7.x/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/release/0.7.x/pypy/interpreter/baseobjspace.py	Fri Aug 26 21:17:17 2005
@@ -6,6 +6,7 @@
 from pypy.interpreter.miscutils import ThreadLocals
 from pypy.tool.cache import Cache 
 from pypy.rpython.rarithmetic import r_uint, intmask
+import os
 
 __all__ = ['ObjSpace', 'OperationError', 'Wrappable', 'BaseWrappable',
            'W_Root']
@@ -190,6 +191,9 @@
         # that differs from the app-visible name (because you 
         # can specify implementation variants)
         builtinmodule_list = [(x, None) for x in modules]
+        bml = builtinmodule_list
+        if ('posix', None) in bml:
+            bml[bml.index( ('posix', None) )] = (os.name, 'posix')
         if self.options.parser == "pypy":
             builtinmodule_list.append(('parser', 'recparser'))
             builtinmodule_list.append(('symbol', None))

Modified: pypy/release/0.7.x/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/release/0.7.x/pypy/module/posix/test/test_posix2.py	(original)
+++ pypy/release/0.7.x/pypy/module/posix/test/test_posix2.py	Fri Aug 26 21:17:17 2005
@@ -1,5 +1,6 @@
 from pypy.objspace.std import StdObjSpace 
 from pypy.tool.udir import udir
+import os
 
 def setup_module(mod): 
     mod.space = StdObjSpace(usemodules=['posix'])
@@ -9,7 +10,7 @@
 class AppTestPosix: 
     def setup_class(cls): 
         cls.space = space 
-        cls.w_posix = space.appexec([], "(): import posix ; return posix")
+        cls.w_posix = space.appexec([], "(): import %s as m ; return m" % os.name)
         cls.w_path = space.wrap(str(path))
     
     def test_posix_is_pypy_s(self): 

Modified: pypy/release/0.7.x/pypy/rpython/module/test/test_posix.py
==============================================================================
--- pypy/release/0.7.x/pypy/rpython/module/test/test_posix.py	(original)
+++ pypy/release/0.7.x/pypy/rpython/module/test/test_posix.py	Fri Aug 26 21:17:17 2005
@@ -1,6 +1,7 @@
 from pypy.rpython.test.test_llinterp import interpret
 from pypy.tool.udir import udir 
-import os, posix
+import os
+exec 'import %s as posix' % os.name
 
 def setup_module(module):
     testf = udir.join('test.txt')
@@ -99,4 +100,6 @@
     fi = os.open(path,os.O_RDWR,0777)
     func = interpret(f,[fi,6]) 
     assert os.fstat(fi).st_size == 6
-    
+
+if not hasattr(os, 'ftruncate'):
+    del test_ftruncate



More information about the Pypy-commit mailing list