[pypy-svn] r16713 - pypy/release/0.7.x/pypy/module/posix/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Aug 27 11:18:27 CEST 2005


Author: cfbolz
Date: Sat Aug 27 11:18:26 2005
New Revision: 16713

Added:
   pypy/release/0.7.x/pypy/module/posix/test/test_posix_libfile.py
Log:
test for os.fdopen that uses libfile


Added: pypy/release/0.7.x/pypy/module/posix/test/test_posix_libfile.py
==============================================================================
--- (empty file)
+++ pypy/release/0.7.x/pypy/module/posix/test/test_posix_libfile.py	Sat Aug 27 11:18:26 2005
@@ -0,0 +1,25 @@
+from pypy.objspace.std import StdObjSpace 
+from pypy.tool.udir import udir
+import os
+
+def setup_module(mod): 
+    mod.space = StdObjSpace(usemodules=['posix'], uselibfile=True)
+    mod.path = udir.join('posixtestfile.txt') 
+    mod.path.write("this is a test")
+
+class AppTestPosix: 
+    def setup_class(cls): 
+        cls.space = space 
+        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): 
+        assert self.posix.__file__ 
+
+    def test_fdopen(self):
+        path = self.path 
+        posix = self.posix 
+        fd = posix.open(path, posix.O_RDONLY, 0777)
+        f = posix.fdopen(fd, "r")
+        result = f.read()
+        assert result == "this is a test"



More information about the Pypy-commit mailing list