Skip to content

Commit 39a2ded

Browse files
author
neil.schemenauer
committed
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. git-svn-id: http://svn.python.org/projects/python/trunk@69410 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 51ce15b commit 39a2ded

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/test/test_hotshot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import pprint
55
import unittest
6+
import tempfile
67
import _hotshot
78
import gc
89

@@ -127,7 +128,12 @@ def test_bad_sys_path(self):
127128
os.remove(test_support.TESTFN)
128129

129130
def test_logreader_eof_error(self):
130-
self.assertRaises((IOError, EOFError), _hotshot.logreader, ".")
131+
emptyfile = tempfile.NamedTemporaryFile()
132+
try:
133+
self.assertRaises((IOError, EOFError), _hotshot.logreader,
134+
emptyfile.name)
135+
finally:
136+
emptyfile.close()
131137
gc.collect()
132138

133139
def test_main():

0 commit comments

Comments
 (0)