mirror of
https://github.com/python/cpython.git
synced 2025-08-20 00:32:12 +00:00
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.
This commit is contained in:
parent
1d520c1921
commit
b29642f129
1 changed files with 7 additions and 1 deletions
|
@ -3,6 +3,7 @@ import hotshot.log
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import unittest
|
import unittest
|
||||||
|
import tempfile
|
||||||
import _hotshot
|
import _hotshot
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
|
@ -127,7 +128,12 @@ class HotShotTestCase(unittest.TestCase):
|
||||||
os.remove(test_support.TESTFN)
|
os.remove(test_support.TESTFN)
|
||||||
|
|
||||||
def test_logreader_eof_error(self):
|
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()
|
gc.collect()
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue