[V1,3/4] framework/test_case: Add skip_unsupported decorator.

Message ID 20230712193126.1994361-4-ke1.xu@intel.com (mailing list archive)
State New
Headers
Series Updating packet module and introducing a new common module. |

Commit Message

Ke Xu July 12, 2023, 7:31 p.m. UTC
  Add a new decorator for marking unsupported cases.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 framework/test_case.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
  

Patch

diff --git a/framework/test_case.py b/framework/test_case.py
index 68f89407..35342de0 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -628,3 +628,24 @@  def skip_unsupported_host_driver(drivers):
         return wrapper
 
     return decorator
+
+
+def skip_unsupported(do_skip: bool = True, reason: str = None):
+    """
+    Skip case which are not supported. This means a case may be supported in future or in other branches.
+    """
+
+    def decorator(func):
+        @wraps(func)
+        def wrapper(*args, **kwargs):
+            test_case = args[0]
+            if do_skip:
+                raise VerifySkip(
+                    "DPDK currently do not support this case"
+                    + (" for %s" % reason if reason else "")
+                )
+            return func(*args, **kwargs)
+
+        return wrapper
+
+    return decorator