Commit cdf7f1af authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

[py] Added decorator

parent 51c47c13
Pipeline #45381 failed with stage
in 4 minutes and 20 seconds
......@@ -148,3 +148,32 @@ def atnt_database_directory():
return atnt_downloaded_directory
def mxnet_available(test):
"""Decorator to check if the mxnet is present, before running the test"""
@functools.wraps(test)
def wrapper(*args, **kwargs):
try:
import mxnet
return test(*args, **kwargs)
except ImportError as e:
raise SkipTest("Skipping test since `mxnet` is not available: %s" % e)
return wrapper
def tensorflow_available(test):
"""Decorator to check if the mxnet is present, before running the test"""
@functools.wraps(test)
def wrapper(*args, **kwargs):
try:
import tensorflow
return test(*args, **kwargs)
except ImportError as e:
raise SkipTest("Skipping test since `mxnet` is not available: %s" % e)
return wrapper
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment