def _do_skips(self, cls): if hasattr(cls, '__requires__'): def test_suite(): return 'ok' test_suite.__name__ = cls.__name__ for requirement in cls.__requires__: check = getattr(requires, requirement) check(test_suite)() if cls.__unsupported_on__: spec = testing.db_spec(*cls.__unsupported_on__) if spec(testing.db): raise SkipTest( "'%s' unsupported on DB implementation '%s'" % ( cls.__name__, testing.db.name) ) if getattr(cls, '__only_on__', None): spec = testing.db_spec(*util.to_list(cls.__only_on__)) if not spec(testing.db): raise SkipTest( "'%s' unsupported on DB implementation '%s'" % ( cls.__name__, testing.db.name) ) if getattr(cls, '__skip_if__', False): for c in getattr(cls, '__skip_if__'): if c(): raise SkipTest("'%s' skipped by %s" % ( cls.__name__, c.__name__) ) for db, op, spec in getattr(cls, '__excluded_on__', ()): testing.exclude(db, op, spec, "'%s' unsupported on DB %s version %s" % ( cls.__name__, testing.db.name, testing._server_version()))
def __should_skip_for(self, cls): if hasattr(cls, '__requires__'): def test_suite(): return 'ok' test_suite.__name__ = cls.__name__ for requirement in cls.__requires__: check = getattr(requires, requirement) if check(test_suite)() != 'ok': # The requirement will perform messaging. return True if cls.__unsupported_on__: spec = testing.db_spec(*cls.__unsupported_on__) if spec(testing.db): print "'%s' unsupported on DB implementation '%s'" % ( cls.__class__.__name__, testing.db.name) return True if getattr(cls, '__only_on__', None): spec = testing.db_spec(*util.to_list(cls.__only_on__)) if not spec(testing.db): print "'%s' unsupported on DB implementation '%s'" % ( cls.__class__.__name__, testing.db.name) return True if getattr(cls, '__skip_if__', False): for c in getattr(cls, '__skip_if__'): if c(): print "'%s' skipped by %s" % ( cls.__class__.__name__, c.__name__) return True for rule in getattr(cls, '__excluded_on__', ()): if testing._is_excluded(*rule): print "'%s' unsupported on DB %s version %s" % ( cls.__class__.__name__, testing.db.name, _server_version()) return True return False