def requires(*things): '''skip test case unless there is thing in ROLES''' try: for thing in things: locate_ns_item(ROLES, thing) except KeyError: return unittest.skip("no %r found in ROLES" % thing) return lambda function: function
def wrapped(): '''create propper decorator --- either skipping one or "empty" one''' if not any(map(condition, locate_ns_item(ROLES, thing))): return unittest.skip("no suitable items found in ROLES.%s" % thing) return lambda function: function