]> granicus.if.org Git - python/commitdiff
Fix broken test in test_hotshot. Treating the current directory as an
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 2 Nov 2009 00:59:52 +0000 (00:59 +0000)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 2 Nov 2009 00:59:52 +0000 (00:59 +0000)
empty file is sloppy and non-portable.  Use NamedTemporaryFile to make
an empty file.

Lib/test/test_hotshot.py

index 35ca6aa7f799fc12539541fcb08e03a1a6cc359e..fa6b2f1629f1151681ce5e7e39d7bd1c445310c9 100644 (file)
@@ -3,6 +3,7 @@ import hotshot.log
 import os
 import pprint
 import unittest
+import tempfile
 import _hotshot
 import gc
 
@@ -127,7 +128,12 @@ class HotShotTestCase(unittest.TestCase):
                 os.remove(test_support.TESTFN)
 
     def test_logreader_eof_error(self):
-        self.assertRaises((IOError, EOFError), _hotshot.logreader, ".")
+        emptyfile = tempfile.NamedTemporaryFile()
+        try:
+            self.assertRaises((IOError, EOFError), _hotshot.logreader,
+                              emptyfile.name)
+        finally:
+            emptyfile.close()
         gc.collect()
 
 def test_main():