There was an error while loading. Please reload this page.
1 parent 759de2b commit 5666a1dCopy full SHA for 5666a1d
1 file changed
Lib/test/test_linecache.py
@@ -37,11 +37,14 @@ def f():
37
def f():
38
return 3''' # No ending newline
39
40
-
41
SOURCE_4 = '''
42
raise OSError
43
'''
44
+def raise_oserror(*args, **kwargs):
45
+ raise OSError
46
+
47
48
class TempFile:
49
50
def setUp(self):
@@ -190,8 +193,7 @@ def test_checkcache_oserror(self):
190
193
_ = linecache.getlines(FILENAME)
191
194
self.assertTrue(_)
192
195
self.assertEqual(1, len(linecache.cache.keys()))
- def raise_oserror(*args, **kwargs):
- raise OSError
196
197
with support.swap_attr(os, 'stat', raise_oserror):
198
# pop all cache
199
_ = linecache.checkcache()
@@ -202,8 +204,6 @@ def test_updatecache_oserror(self):
202
204
source_name = os_helper.TESTFN
203
205
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
206
207
with open(source_name, 'w', encoding='utf-8') as source:
208
source.write(SOURCE_4)
209
_ = linecache.getlines(source_name)
0 commit comments