[V2,4/5] framework/test_case: add skip_unsupported_host_driver decorator
Commit Message
add decorator
Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
V2: reformat framework/test_case.py
framework/test_case.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
@@ -606,3 +606,25 @@ def check_supported_nic(nics):
return wrapper
return decorator
+
+
+def skip_unsupported_host_driver(drivers):
+ """
+ Skip case which are not supported by the host driver(vfio-pci/igb_uio etc.)
+ """
+ if isinstance(drivers, str):
+ drivers = [drivers]
+
+ def decorator(func):
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ test_case = args[0]
+ if test_case.drivername in drivers:
+ raise VerifySkip(
+ "{} do not support this case".format(test_case.drivername)
+ )
+ return func(*args, **kwargs)
+
+ return wrapper
+
+ return decorator