aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests/helpers.py
diff options
context:
space:
mode:
authorLovett, Trevor <trevor.lovett@att.com>2019-10-16 11:26:16 -0500
committerTrevor Lovett <trevor.lovett@att.com>2019-10-16 16:59:05 +0000
commit48d35093a120d5a8c02a28c4a72f4f7d69b664f4 (patch)
tree2cd1476affa455dcb00d0ec6bbebf59f0e600c3e /ice_validator/tests/helpers.py
parent842888dc28ebccab45e627669f7ee23f04920dc7 (diff)
[VVP] Support any_of in categories decorator
If specified, then the test will be selected if any of the passed categories from the command line are in the tests categories. This is different than the default behavior where all categories must match Change-Id: Iee08556d6c07eac2663ff2ff2e89bcd7a18cd392 Issue-ID: VVP-330 Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Diffstat (limited to 'ice_validator/tests/helpers.py')
-rw-r--r--ice_validator/tests/helpers.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py
index 764be11..424dde1 100644
--- a/ice_validator/tests/helpers.py
+++ b/ice_validator/tests/helpers.py
@@ -124,16 +124,21 @@ def validates(*requirement_ids):
return decorator
-def categories(*categories):
+def categories(*all_of, any_of=None):
+ any_of = set(any_of) if any_of else set()
+ all_of = set(all_of) if all_of else set()
+
def decorator(func):
@funcutils.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
- wrapper.categories = categories
+ wrapper.all_categories = all_of
+ wrapper.any_categories = any_of
return wrapper
- decorator.categories = categories
+ decorator.all_categories = all_of
+ decorator.any_categories = any_of
return decorator