[pypy-commit] pypy win32-cleanup2: add a test in the proper place, fix failing test

mattip noreply at buildbot.pypy.org
Thu Apr 5 01:18:42 CEST 2012


Author: Matti Picus <matti.picus at gmail.com>
Branch: win32-cleanup2
Changeset: r54188:2eeb44e7e81f
Date: 2012-04-05 00:47 +0300
http://bitbucket.org/pypy/pypy/changeset/2eeb44e7e81f/

Log:	add a test in the proper place, fix failing test

diff --git a/pypy/rpython/module/test/test_ll_os.py b/pypy/rpython/module/test/test_ll_os.py
--- a/pypy/rpython/module/test/test_ll_os.py
+++ b/pypy/rpython/module/test/test_ll_os.py
@@ -84,8 +84,10 @@
         if (len == 0) and "WINGDB_PYTHON" in os.environ:
             # the ctypes call seems not to work in the Wing debugger
             return
-        assert str(buf.value).lower() == pwd
-        # ctypes returns the drive letter in uppercase, os.getcwd does not
+        assert str(buf.value).lower() == pwd.lower()
+        # ctypes returns the drive letter in uppercase, 
+        # os.getcwd does not, 
+        # but there may be uppercase in os.getcwd path
 
     pwd = os.getcwd()
     try:
@@ -187,7 +189,18 @@
         OSError, ll_execve, "/etc/passwd", [], {})
     assert info.value.errno == errno.EACCES
 
-
+def test_os_write():
+    #Same as test in rpython/test/test_rbuiltin
+    fname = str(udir.join('os_write_test.txt'))
+    fd = os.open(fname, os.O_WRONLY|os.O_CREAT, 0777)
+    assert fd >= 0
+    os.write(fd, 'Hello world')
+    os.close(fd)
+    hello = open(fname).read()
+    assert hello == "Hello world"
+    fd = os.open(fname, os.O_WRONLY|os.O_CREAT, 0777)
+    os.close(fd)
+    raises(OSError, os.write, fd, 'Hello world')
 
 class ExpectTestOs:
     def setup_class(cls):


More information about the pypy-commit mailing list