MCPcopy
hub / github.com/borgbackup/borg / test_exclude_patterns_from_file

Function test_exclude_patterns_from_file

src/borg/testsuite/patterns_test.py:410–426  ·  view source on GitHub ↗
(tmpdir, lines, expected)

Source from the content-addressed store, hash-verified

408 ],
409)
410def test_exclude_patterns_from_file(tmpdir, lines, expected):
411 files = ["data/something00.txt", "more/data", "home", " #/wsfoobar", "\tstart/whitespace", "whitespace/end\t"]
412
413 def evaluate(filename):
414 patterns = []
415 with open(filename) as f:
416 load_exclude_file(f, patterns)
417 matcher = PatternMatcher(fallback=True)
418 matcher.add_inclexcl(patterns)
419 return [path for path in files if matcher.match(path)]
420
421 exclfile = tmpdir.join("exclude.txt")
422
423 with exclfile.open("wt") as fh:
424 fh.write("\n".join(lines))
425
426 assert evaluate(str(exclfile)) == (files if expected is None else expected)
427
428
429@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

evaluateFunction · 0.85
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected