[pypy-svn] r15275 - pypy/dist/pypy/module/posix/test

hpk at codespeak.net hpk at codespeak.net
Thu Jul 28 18:51:17 CEST 2005


Author: hpk
Date: Thu Jul 28 18:51:16 2005
New Revision: 15275

Added:
   pypy/dist/pypy/module/posix/test/test_posix2.py
Log:
added some basic tests that actually test the
appvisible posix module 



Added: pypy/dist/pypy/module/posix/test/test_posix2.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/module/posix/test/test_posix2.py	Thu Jul 28 18:51:16 2005
@@ -0,0 +1,33 @@
+from pypy.objspace.std import StdObjSpace 
+from pypy.tool.udir import udir
+
+def setup_module(mod): 
+    mod.space = StdObjSpace(usemodules=['posix'])
+    mod.path = udir.join('posixtestfile.txt') 
+    mod.path.write("this is a test")
+
+class AppTestPosix: 
+    def setup_class(cls): 
+        cls.space = space 
+    
+    def test_posix_is_pypy_s(self): 
+        import posix
+        assert posix.__file__ 
+
+def test_some_posix_basic_operation(): 
+    w_path = space.wrap(str(path))
+    space.appexec([w_path], """(path):
+        import posix
+        fd = posix.open(path, posix.O_RDONLY, 0777)
+        fd2 = posix.dup(fd)
+        assert not posix.isatty(fd2) 
+        s = posix.read(fd, 1)
+        assert s == 't'
+        posix.lseek(fd, 5, 0)
+        s = posix.read(fd, 1)
+        assert s == 'i'
+        stat = posix.fstat(fd) 
+        assert stat  # XXX 
+        posix.close(fd2)
+        posix.close(fd)
+    """)



More information about the Pypy-commit mailing list