From 1eaf9dc7776b9833a9fb62fe630b4b9ac63a31f4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 30 Dec 2018 22:02:12 -0500 Subject: [PATCH] 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 --- lib/sqlalchemy/testing/exclusions.py | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) 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) -- 2.47.2