File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,14 @@ def f():
37
37
def f():
38
38
return 3''' # No ending newline
39
39
40
-
41
40
SOURCE_4 = '''
42
41
raise OSError
43
42
'''
44
43
44
+ def raise_oserror (* args , ** kwargs ):
45
+ raise OSError
46
+
47
+
45
48
class TempFile :
46
49
47
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 ()))
193
- def raise_oserror (* args , ** kwargs ):
194
- raise OSError
196
+
195
197
with support .swap_attr (os , 'stat' , raise_oserror ):
196
198
# pop all cache
197
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 )
204
206
205
- def raise_oserror (* args , ** kwargs ):
206
- raise OSError
207
207
with open (source_name , 'w' , encoding = 'utf-8' ) as source :
208
208
source .write (SOURCE_4 )
209
209
_ = linecache .getlines (source_name )
You can’t perform that action at this time.
0 commit comments