<s> import functools <EOL> import six <EOL> from testtools import testcase <EOL> import tooz <EOL> def _skip_decorator ( func ) : <EOL> @ functools . wraps ( func ) <EOL> def skip_if_not_implemented ( * args , ** kwargs ) : <EOL> try : <EOL> return func ( * args , ** kwargs ) <EOL> except tooz . NotImplemented as e : <EOL> raise testcase . TestSkipped ( str ( e ) ) <EOL> return skip_if_not_implemented <EOL> class SkipNotImplementedMeta ( type ) : <EOL> def __new__ ( cls , name , bases , local ) : <EOL> for attr in local : <EOL> value = local [ attr ] <EOL> if callable ( value ) and ( <EOL> attr . startswith ( '<STR_LIT>' ) or attr == '<STR_LIT>' ) : <EOL> local [ attr ] = _skip_decorator ( value ) <EOL> return type . __new__ ( cls , name , bases , local ) <EOL> @ six . add_metaclass ( SkipNotImplementedMeta ) <EOL> class TestCaseSkipNotImplemented ( testcase . TestCase ) : <EOL> pass </s>
