[Python-checkins] r76049 - python/branches/release26-maint/Lib/test/test_hotshot.py
neil.schemenauer
python-checkins at python.org
Mon Nov 2 01:59:52 CET 2009
Author: neil.schemenauer
Date: Mon Nov 2 01:59:52 2009
New Revision: 76049
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/branches/release26-maint/Lib/test/test_hotshot.py
Modified: python/branches/release26-maint/Lib/test/test_hotshot.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_hotshot.py (original)
+++ python/branches/release26-maint/Lib/test/test_hotshot.py Mon Nov 2 01:59:52 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