diff --git a/Lib/test/test_hotshot.py b/Lib/test/test_hotshot.py index 35ca6aa7f79..fa6b2f1629f 100644 --- a/Lib/test/test_hotshot.py +++ b/Lib/test/test_hotshot.py @@ -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():