def skip_unless_any_tag(*tags): base_decorator = tag(*tags) def decorator(obj): obj = base_decorator(obj) if hasattr(obj, 'explicit_tags'): obj.tags = obj.tags.union(tags) else: setattr(obj, 'explicit_tags', set(tags)) return obj return decorator
def ready(self): # tag all functional tests with 'functional' # collect all modules of this package modules = getModules(sys.modules[self.name]) # iterate over the moules for module in modules: # get the classes of the module clsmembers = inspect.getmembers(module, inspect.isclass) for clsName, cls in clsmembers: # check if it's a selenium test case if cls.__module__ == module.__name__ and \ issubclass(cls, SeleniumTestCase): # tag it setattr(module, clsName, tag("functional")(cls))
def tag_process(*slugs): """Decorate unit test to tag it for a specific process.""" slugs = [generate_process_tag(slug) for slug in slugs] slugs.append(TAG_PROCESS) # Also tag with a general process tag. return tag(*slugs)
def testIsBroken(method): return tag("broken")(method)