[Python-checkins] r69410 - python/trunk/Lib/test/test_hotshot.py

neil.schemenauer python-checkins at python.org
Sat Feb 7 15:53:32 CET 2009


Author: neil.schemenauer
Date: Sat Feb 7 15:53:31 2009
New Revision: 69410
Log:
Fix broken test in test_hotshot. Treating the current directory as an
empty file is sloppy and non-portable. Use NamedTemporaryFile to make
an empty file.
Modified:
 python/trunk/Lib/test/test_hotshot.py
Modified: python/trunk/Lib/test/test_hotshot.py
==============================================================================
--- python/trunk/Lib/test/test_hotshot.py	(original)
+++ python/trunk/Lib/test/test_hotshot.py	Sat Feb 7 15:53:31 2009
@@ -3,6 +3,7 @@
 import os
 import pprint
 import unittest
+import tempfile
 import _hotshot
 import gc
 
@@ -127,7 +128,12 @@
 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():


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /