[pypy-dev] test_file fails, hard-coded tmp dir to blame?

A.B., Khalid abkhd at hotmail.com
Mon Jan 17 03:29:27 CET 2005


test_file fails at this end. It seems that it tries to create a '/tmp/tt' 
file, but it fails. This is so because my temp directory is at 
'/windows/temp' not '/tmp'.

If I correctly understand this problem, then find attached a fix that got 
the test to pass. Hope that helps.


PS. In case the developers here are interested to know, all the tests pass 
now on this box, including the JAVA and LISP ones which are made to use 
Jikes (version 1.20) and GNU CLISP (version 2.33) on Win98, MinGW built 
Python (from CVS), and GCC 3.4.2 (MinGW special).

Index: pypy/appspace/test/test_file.py
--- pypy/appspace/test/test_file.py	(revision 8317)
+++ pypy/appspace/test/test_file.py	(working copy)
@@ -16,8 +16,10 @@
         assert self.fd.tell() == 0

     def test_case_readonly(self):
-        f=_file.file_('/tmp/tt', 'w')
-        assert f.name == '/tmp/tt'
+        from tempfile import mktemp
+        fn = mktemp()
+        f=_file.file_(fn, 'w')
+        assert f.name == fn
         assert f.mode == 'w'
         assert f.closed == False
         assert f.encoding == None # Fix when we find out what this is

Express yourself instantly with MSN Messenger! Download today it's FREE! 

More information about the Pypy-dev mailing list