1717
1818# See comments in test_hapitime2datetime.py for other execution options.
1919
20- def clearcache (opts ):
21- shutil .rmtree (opts ['cachedir' ], ignore_errors = True )
22-
23-
2420def writepickle (fname , var ):
2521 print ("!!!!!!!!!!!!!!" )
2622 print ("Writing " + fname )
@@ -121,15 +117,15 @@ def test_reader_short():
121117 opts ['cache' ] = False
122118
123119 # Read one parameter
124- clearcache (opts )
120+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
125121 assert readcompare (server , dataset , 'scalar' , run , opts )
126122
127123 # Read two parameters
128- clearcache (opts )
124+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
129125 assert readcompare (server , dataset , 'scalar,vector' , run , opts )
130126
131127 # Read all parameters
132- clearcache (opts )
128+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
133129 assert readcompare (server , dataset , '' , run , opts )
134130
135131 #
@@ -138,16 +134,16 @@ def test_reader_short():
138134 opts ['cache' ] = True
139135
140136 # Read one parameter
141- clearcache (opts )
137+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
142138 assert readcompare (server , dataset , 'scalar' , run , opts )
143139
144140 # Read two parameters
145- clearcache (opts )
141+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
146142 assert readcompare (server , dataset , 'scalar,vector' , run , opts )
147- clearcache (opts )
143+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
148144
149145 # Read all parameters
150- clearcache (opts )
146+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
151147 assert readcompare (server , dataset , '' , run , opts )
152148
153149
@@ -162,7 +158,7 @@ def test_cache_short():
162158 opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : True }
163159
164160 opts ['usecache' ] = False
165- clearcache (opts )
161+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
166162 data , meta = hapi (server , dataset , 'scalarint,vectorint' , start , stop , ** opts )
167163
168164 opts ['usecache' ] = True
@@ -182,21 +178,21 @@ def test_subset_short():
182178 opts ['usecache' ] = False
183179
184180 # Request two subsets with empty cache. Common parts should be same.
185- clearcache (opts )
181+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
186182 data , meta = hapi (server , dataset , 'scalarint' , start , stop , ** opts )
187183
188- clearcache (opts )
184+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
189185 data2 , meta2 = hapi (server , dataset , 'scalarint,vectorint' , start , stop , ** opts )
190186
191187 ok = np .array_equal (data ['Time' ], data2 ['Time' ])
192188 ok = ok and np .array_equal (data ['scalarint' ], data2 ['scalarint' ])
193189 assert ok
194190
195191 # Request all parameters and single parameter. Common parameter should be same.
196- clearcache (opts )
192+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
197193 data , meta = hapi (server , dataset , '' , start , stop , ** opts )
198194
199- clearcache (opts )
195+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
200196 data2 , meta2 = hapi (server , dataset , 'vectorint' , start , stop , ** opts )
201197
202198 ok = np .array_equal (data ['Time' ], data2 ['Time' ])
@@ -217,7 +213,7 @@ def test_subset_short():
217213
218214 # Request all parameters and single parameter, with the single parameter
219215 # request using the cache with hot cache. Common parameter should be same.
220- clearcache (opts )
216+ shutil . rmtree (opts [ 'cachedir' ], ignore_errors = True )
221217 data , meta = hapi (server , dataset , '' , start , stop , ** opts )
222218 data2 , meta2 = hapi (server , dataset , 'vectorint' , start , stop , ** opts )
223219
@@ -232,29 +228,16 @@ def test_reader_long():
232228 dataset = 'dataset1'
233229 run = 'long'
234230
235- # Read two parameters
231+ # Read three parameters
236232 opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : False , 'usecache' : False }
237- assert readcompare (server , dataset , 'scalar,vector' , run , opts )
233+ assert readcompare (server , dataset , 'scalar,vector,spectra ' , run , opts )
238234
239235 opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : True , 'usecache' : False }
240- assert readcompare (server , dataset , 'scalar,vector' , run , opts )
236+ assert readcompare (server , dataset , 'scalar,vector,spectra ' , run , opts )
241237
242238 opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : False , 'usecache' : True }
243- assert readcompare (server , dataset , 'scalar,vector' , run , opts )
244-
245-
246- @pytest .mark .verylong
247- def test_reader_very_long ():
248-
249- dataset = 'dataset1'
250- run = 'verylong'
251-
252- opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : True , 'usecache' : False }
253- assert readcompare (server , dataset , '' , run , opts )
254-
255- opts = {'logging' : False , 'cachedir' : '/tmp/hapi-data' , 'cache' : False , 'usecache' : True }
256- assert readcompare (server , dataset , '' , run , opts )
239+ assert readcompare (server , dataset , 'scalar,vector,spectra' , run , opts )
257240
258241
259242if __name__ == '__main__' :
260- test_reader_short ()
243+ test_reader_long ()
0 commit comments