From: Mike Bayer Date: Mon, 31 Dec 2018 03:02:12 +0000 (-0500) Subject: rework the exclusions spec expression X-Git-Tag: rel_1_3_0b2~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1eaf9dc7776b9833a9fb62fe630b4b9ac63a31f4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git rework the exclusions spec expression The expression was expecting spaces which means we were skipping Postgresql window function tests and possibly other things. Change-Id: I57c4aed558f4011f2f7b882a2d9b1fee210f9eaf --- diff --git a/lib/sqlalchemy/testing/exclusions.py b/lib/sqlalchemy/testing/exclusions.py index 65b70a5a31..512fffb3bf 100644 --- a/lib/sqlalchemy/testing/exclusions.py +++ b/lib/sqlalchemy/testing/exclusions.py @@ -6,14 +6,15 @@ # the MIT License: http://www.opensource.org/licenses/mit-license.php -import operator -from ..util import decorator -from . import config -from .. import util -import inspect import contextlib +import operator +import re + from sqlalchemy.util.compat import inspect_getargspec +from . import config +from .. import util +from ..util import decorator def skip_if(predicate, reason=None): rule = compound() @@ -190,13 +191,18 @@ class Predicate(object): elif isinstance(predicate, tuple): return SpecPredicate(*predicate) elif isinstance(predicate, util.string_types): - tokens = predicate.split(" ", 2) - op = spec = None - db = tokens.pop(0) - if tokens: - op = tokens.pop(0) - if tokens: - spec = tuple(int(d) for d in tokens.pop(0).split(".")) + tokens = re.match( + r'([\+\w]+)\s*(?:(>=|==|!=|<=|<|>)\s*([\d\.]+))?', predicate) + if not tokens: + raise ValueError( + "Couldn't locate DB name in predicate: %r" % predicate) + db = tokens.group(1) + op = tokens.group(2) + spec = ( + tuple(int(d) for d in tokens.group(3).split(".")) + if tokens.group(3) else None + ) + return SpecPredicate(db, op, spec, description=description) elif util.callable(predicate): return LambdaPredicate(predicate, description)