[pypy-svn] r7550 - in pypy/trunk/src/pypy/appspace: . test

mgedmin at codespeak.net mgedmin at codespeak.net
Mon Nov 22 11:46:01 CET 2004


Author: mgedmin
Date: Mon Nov 22 11:46:00 2004
New Revision: 7550

Modified:
   pypy/trunk/src/pypy/appspace/sio.py
   pypy/trunk/src/pypy/appspace/test/test_file.py
Log:
Fixed a failing test.



Modified: pypy/trunk/src/pypy/appspace/sio.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/sio.py	(original)
+++ pypy/trunk/src/pypy/appspace/sio.py	Mon Nov 22 11:46:00 2004
@@ -566,13 +566,13 @@
         except KeyError:
             raise ValueError, "mode should be 'r', 'r+', 'w', 'w+' or 'a+'"
 
-        if hasattr(os, "O_BINARY"):
-            flag |= os.O_BINARY
+        O_BINARY = getattr(os, "O_BINARY", 0)
+        flag |= O_BINARY
         try:
             self.fd = os.open(filename, flag)
         except OSError:
             # Opening in mode 'a' or 'a+' and file already exists
-            flag = flag & (os.O_RDWR | os.O_BINARY)
+            flag = flag & (os.O_RDWR | O_BINARY)
             self.fd = os.open(filename, flag)
         if mode[0] == 'a':
             os.lseek(self.fd, 0, 2) # Move to end of file

Modified: pypy/trunk/src/pypy/appspace/test/test_file.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/test/test_file.py	(original)
+++ pypy/trunk/src/pypy/appspace/test/test_file.py	Mon Nov 22 11:46:00 2004
@@ -1,10 +1,12 @@
+import os
 import autopath
 from pypy.appspace import _file
 import unittest
 
 class FileTestCase(unittest.TestCase):
     def setUp(self):
-        self.fd = _file.file_('test_file.py', 'r')
+        filename = os.path.join(autopath.this_dir, 'test_file.py')
+        self.fd = _file.file_(filename, 'r')
 
     def tearDown(self):
         self.fd.close()



More information about the Pypy-commit mailing list