@@ -299,26 +299,25 @@ def _requires_unix_version(sysname, min_version):
299
299
For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
300
300
the FreeBSD version is less than 7.2.
301
301
"""
302
- def decorator (func ):
303
- @functools .wraps (func )
304
- def wrapper (* args , ** kw ):
305
- import platform
306
- if platform .system () == sysname :
307
- version_txt = platform .release ().split ('-' , 1 )[0 ]
308
- try :
309
- version = tuple (map (int , version_txt .split ('.' )))
310
- except ValueError :
311
- pass
312
- else :
313
- if version < min_version :
314
- min_version_txt = '.' .join (map (str , min_version ))
315
- raise unittest .SkipTest (
316
- "%s version %s or higher required, not %s"
317
- % (sysname , min_version_txt , version_txt ))
318
- return func (* args , ** kw )
319
- wrapper .min_version = min_version
320
- return wrapper
321
- return decorator
302
+ import platform
303
+ min_version_txt = '.' .join (map (str , min_version ))
304
+ version_txt = platform .release ().split ('-' , 1 )[0 ]
305
+ if platform .system () == sysname :
306
+ try :
307
+ version = tuple (map (int , version_txt .split ('.' )))
308
+ except ValueError :
309
+ skip = False
310
+ else :
311
+ skip = version < min_version
312
+ else :
313
+ skip = False
314
+
315
+ return unittest .skipIf (
316
+ skip ,
317
+ f"{ sysname } version { min_version_txt } or higher required, not "
318
+ f"{ version_txt } ."
319
+ )
320
+
322
321
323
322
def requires_freebsd_version (* min_version ):
324
323
"""Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
0 commit comments