From 190107ada77156e3703d3b7589b911c2d6da6dff Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Mon, 18 Jan 2016 15:11:28 +0100 Subject: [PATCH] =?UTF-8?q?Replace=20use=20of=20=E2=80=9Cexclude=5Fpath?= =?UTF-8?q?=E2=80=9D=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The newly added pattern matcher class can replace the “exclude_path” function. The latter is going to be removed in a later change. --- borg/testsuite/helpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/borg/testsuite/helpers.py b/borg/testsuite/helpers.py index ee8a9e91d..22bfe903e 100644 --- a/borg/testsuite/helpers.py +++ b/borg/testsuite/helpers.py @@ -9,7 +9,7 @@ import sys import msgpack import msgpack.fallback -from ..helpers import exclude_path, Location, format_file_size, format_timedelta, PathPrefixPattern, FnmatchPattern, make_path_safe, \ +from ..helpers import Location, format_file_size, format_timedelta, PathPrefixPattern, FnmatchPattern, make_path_safe, \ prune_within, prune_split, get_cache_dir, Statistics, is_slow_msgpack, yes, RegexPattern, \ StableDict, int_to_bigint, bigint_to_int, parse_timestamp, CompressionSpec, ChunkerParams, \ ProgressIndicatorPercent, ProgressIndicatorEndless, load_excludes, parse_pattern, PatternMatcher @@ -334,8 +334,9 @@ def test_patterns_from_file(tmpdir, lines, expected): ] def evaluate(filename): - patterns = load_excludes(open(filename, "rt")) - return [path for path in files if not exclude_path(path, patterns)] + matcher = PatternMatcher(fallback=True) + matcher.add(load_excludes(open(filename, "rt")), False) + return [path for path in files if matcher.match(path)] exclfile = tmpdir.join("exclude.txt")