@@ -118,13 +118,9 @@ def get_bad_bb(self):
118
118
# means do not check
119
119
return None
120
120
121
- @classmethod
122
- def setUpClass (cls ):
123
- if cls .header_class is None :
124
- raise SkipTest ("no testing methods from the abstract class" )
125
-
126
-
127
121
def test_general_init (self ):
122
+ if not self .header_class :
123
+ pytest .skip ()
128
124
hdr = self .header_class ()
129
125
# binaryblock has length given by header data dtype
130
126
binblock = hdr .binaryblock
@@ -144,6 +140,8 @@ def _set_something_into_hdr(self, hdr):
144
140
145
141
def test__eq__ (self ):
146
142
# Test equal and not equal
143
+ if not self .header_class :
144
+ pytest .skip ()
147
145
hdr1 = self .header_class ()
148
146
hdr2 = self .header_class ()
149
147
assert hdr1 == hdr2
@@ -160,6 +158,8 @@ def test__eq__(self):
160
158
161
159
def test_to_from_fileobj (self ):
162
160
# Successful write using write_to
161
+ if not self .header_class :
162
+ pytest .skip ()
163
163
hdr = self .header_class ()
164
164
str_io = BytesIO ()
165
165
hdr .write_to (str_io )
@@ -169,6 +169,8 @@ def test_to_from_fileobj(self):
169
169
assert hdr2 .binaryblock == hdr .binaryblock
170
170
171
171
def test_mappingness (self ):
172
+ if not self .header_class :
173
+ pytest .skip ()
172
174
hdr = self .header_class ()
173
175
with pytest .raises (ValueError ):
174
176
hdr .__setitem__ ('nonexistent key' , 0.1 )
@@ -205,12 +207,16 @@ def test_endianness_ro(self):
205
207
endianness on initialization (or occasionally byteswapping the
206
208
data) - but this is done via via the as_byteswapped method
207
209
'''
210
+ if not self .header_class :
211
+ pytest .skip ()
208
212
hdr = self .header_class ()
209
213
with pytest .raises (AttributeError ):
210
214
hdr .__setattr__ ('endianness' , '<' )
211
215
212
216
def test_endian_guess (self ):
213
217
# Check guesses of endian
218
+ if not self .header_class :
219
+ pytest .skip ()
214
220
eh = self .header_class ()
215
221
assert eh .endianness == native_code
216
222
hdr_data = eh .structarr .copy ()
@@ -225,13 +231,17 @@ def test_binblock_is_file(self):
225
231
# strings following. More generally, there may be other perhaps
226
232
# optional data after the binary block, in which case you will need to
227
233
# override this test
234
+ if not self .header_class :
235
+ pytest .skip ()
228
236
hdr = self .header_class ()
229
237
str_io = BytesIO ()
230
238
hdr .write_to (str_io )
231
239
assert str_io .getvalue () == hdr .binaryblock
232
240
233
241
def test_structarr (self ):
234
242
# structarr attribute also read only
243
+ if not self .header_class :
244
+ pytest .skip ()
235
245
hdr = self .header_class ()
236
246
# Just check we can get structarr
237
247
hdr .structarr
@@ -250,6 +260,8 @@ def assert_no_log_err(self, hdr):
250
260
251
261
def test_bytes (self ):
252
262
# Test get of bytes
263
+ if not self .header_class :
264
+ pytest .skip ()
253
265
hdr1 = self .header_class ()
254
266
bb = hdr1 .binaryblock
255
267
hdr2 = self .header_class (hdr1 .binaryblock )
@@ -280,6 +292,8 @@ def test_bytes(self):
280
292
281
293
def test_as_byteswapped (self ):
282
294
# Check byte swapping
295
+ if not self .header_class :
296
+ pytest .skip ()
283
297
hdr = self .header_class ()
284
298
assert hdr .endianness == native_code
285
299
# same code just returns a copy
@@ -304,6 +318,8 @@ def check_fix(self, *args, **kwargs):
304
318
305
319
def test_empty_check (self ):
306
320
# Empty header should be error free
321
+ if not self .header_class :
322
+ pytest .skip ()
307
323
hdr = self .header_class ()
308
324
hdr .check_fix (error_level = 0 )
309
325
@@ -313,6 +329,8 @@ def _dxer(self, hdr):
313
329
return self .header_class .diagnose_binaryblock (binblock )
314
330
315
331
def test_str (self ):
332
+ if not self .header_class :
333
+ pytest .skip ()
316
334
hdr = self .header_class ()
317
335
# Check something returns from str
318
336
s1 = str (hdr )
@@ -326,6 +344,8 @@ class _TestLabeledWrapStruct(_TestWrapStructBase):
326
344
def test_get_value_label (self ):
327
345
# Test get value label method
328
346
# Make a new class to avoid overwriting recoders of original
347
+ if not self .header_class :
348
+ pytest .skip ()
329
349
class MyHdr (self .header_class ):
330
350
_field_recoders = {}
331
351
hdr = MyHdr ()
0 commit comments