[pypy-svn] r8508 - pypy/dist/pypy/appspace/test

arigo at codespeak.net arigo at codespeak.net
Sun Jan 23 19:13:36 CET 2005


Author: arigo
Date: Sun Jan 23 19:13:36 2005
New Revision: 8508

Modified:
   pypy/dist/pypy/appspace/test/test_sio.py
Log:
- fix a case in which temp files were not removed.
- use pypy.tool.udir instead of tempfile.mktemp().


Modified: pypy/dist/pypy/appspace/test/test_sio.py
==============================================================================
--- pypy/dist/pypy/appspace/test/test_sio.py	(original)
+++ pypy/dist/pypy/appspace/test/test_sio.py	Sun Jan 23 19:13:36 2005
@@ -2,7 +2,7 @@
 
 import os
 import time
-import tempfile
+from pypy.tool.udir import udir
 
 from pypy.appspace import sio 
 
@@ -477,6 +477,7 @@
 
 class TestMMapFile(TestBufferingInputStreamTests): 
     tfn = None
+    Counter = 0
 
     def teardown_method(self, method):
         tfn = self.tfn
@@ -488,7 +489,9 @@
                 print "can't remove %s: %s" % (tfn, msg)
 
     def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"):
-        self.tfn = tempfile.mktemp()
+        self.teardown_method(None) # for tests calling makeStream() several time
+        self.tfn = str(udir.join('sio%03d' % TestMMapFile.Counter))
+        TestMMapFile.Counter += 1
         f = open(self.tfn, "wb")
         f.writelines(self.packets)
         f.close()



More information about the Pypy-commit mailing list