diff options
| author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-11-02 00:59:52 (GMT) |
|---|---|---|
| committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-11-02 00:59:52 (GMT) |
| commit | b29642f1297613f84c6678628b12a2bd5e3ae60a (patch) | |
| tree | 2a7d7377afb968bf7283d7eb7c83ae0cb15ada68 | |
| parent | 1d520c192170572c077879a845ecb8fd819fd8b7 (diff) | |
| download | cpython-b29642f1297613f84c6678628b12a2bd5e3ae60a.zip cpython-b29642f1297613f84c6678628b12a2bd5e3ae60a.tar.gz cpython-b29642f1297613f84c6678628b12a2bd5e3ae60a.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.
| -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(): |
