##// END OF EJS Templates
add @onlyif_any_cmd_exists...
MinRK -
Show More
@@ -381,3 +381,20 b' def onlyif_cmds_exist(*commands):'
381 "is installed".format(cmd))
381 "is installed".format(cmd))
382 raise e
382 raise e
383 return null_deco
383 return null_deco
384
385 def onlyif_any_cmd_exists(*commands):
386 """
387 Decorator to skip test unless at least one of `commands` is found.
388 """
389 for cmd in commands:
390 try:
391 if is_cmd_found(cmd):
392 return null_deco
393 except ImportError as e:
394 # is_cmd_found uses pywin32 on windows, which might not be available
395 if sys.platform == 'win32' and 'pywin32' in str(e):
396 return skip("This test runs only if pywin32 and command '{0}' "
397 "is installed".format(cmd))
398 raise e
399 return skip("This test runs only if one of the commands {0} "
400 "is installed".format(commands))
General Comments 0
You need to be logged in to leave comments. Login now