summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-07-08 12:00:06 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-07-08 12:00:06 (GMT)
commit88bf5ca63b894e3b1d61520d9e1e07bc363e616f (patch)
tree88808c6dbf9daef2eb2d301a5177ef06f0844bcf
parent27396a1807fe5971e7e61a51872a030f6d05b9c9 (diff)
parent5d62a61b58bc2d42a734be24f58e64ef18c04e76 (diff)
downloadcpython-88bf5ca63b894e3b1d61520d9e1e07bc363e616f.zip
cpython-88bf5ca63b894e3b1d61520d9e1e07bc363e616f.tar.gz
cpython-88bf5ca63b894e3b1d61520d9e1e07bc363e616f.tar.bz2
Merge
-rw-r--r--Lib/test/test_inspect.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 7ed4ffe..80db03b 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -285,7 +285,10 @@ class TestRetrievingSourceCode(GetSourceBase):
co = compile("None", fn, "exec")
self.assertEqual(inspect.getsourcefile(co), None)
linecache.cache[co.co_filename] = (1, None, "None", co.co_filename)
- self.assertEqual(normcase(inspect.getsourcefile(co)), fn)
+ try:
+ self.assertEqual(normcase(inspect.getsourcefile(co)), fn)
+ finally:
+ del linecache.cache[co.co_filename]
def test_getfile(self):
self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
@@ -407,8 +410,11 @@ class TestBuggyCases(GetSourceBase):
self.assertRaises(IOError, inspect.findsource, co)
self.assertRaises(IOError, inspect.getsource, co)
linecache.cache[co.co_filename] = (1, None, lines, co.co_filename)
- self.assertEqual(inspect.findsource(co), (lines,0))
- self.assertEqual(inspect.getsource(co), lines[0])
+ try:
+ self.assertEqual(inspect.findsource(co), (lines,0))
+ self.assertEqual(inspect.getsource(co), lines[0])
+ finally:
+ del linecache.cache[co.co_filename]
class TestNoEOL(GetSourceBase):
def __init__(self, *args, **kwargs):