File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,9 @@ def __init__(self):
329329 # Declare the placeholder for the current request
330330 self .request = None
331331
332+ # Initiate the storage backend (local, S3, etc) as a class attr
333+ self .storage = storages .create_storage (storages .backends ["scripts" ])
334+
332335 # Compile test methods and initialize results skeleton
333336 for method in dir (self ):
334337 if method .startswith ('test_' ) and callable (getattr (self , method )):
@@ -394,8 +397,7 @@ def filename(self):
394397 return inspect .getfile (self .__class__ )
395398
396399 def findsource (self , object ):
397- storage = storages .create_storage (storages .backends ["scripts" ])
398- with storage .open (os .path .basename (self .filename ), 'r' ) as f :
400+ with self .storage .open (os .path .basename (self .filename ), 'r' ) as f :
399401 data = f .read ()
400402
401403 # Break the source code into lines
You can’t perform that action at this time.
0 commit comments