diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-07 14:53:31 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-07 14:53:31 (GMT) |
commit | 8573d62f8f1ce20b0389792c1f2758f06bdad527 (patch) | |
tree | 6bc4f154ed3603ae423df7b09cad89017db81a1f /Lib | |
parent | 34feea32058ce9610fbb0357661f80232f80d3e4 (diff) | |
download | cpython-8573d62f8f1ce20b0389792c1f2758f06bdad527.zip cpython-8573d62f8f1ce20b0389792c1f2758f06bdad527.tar.gz cpython-8573d62f8f1ce20b0389792c1f2758f06bdad527.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_hotshot.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_hotshot.py b/Lib/test/test_hotshot.py index 35ca6aa..fa6b2f1 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(): |