From 5af89904c9ad33b632305b53058ddc69190f56a9 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 21 Jun 2018 00:15:55 -0700 Subject: Improved .dockerignore pattern processing to better match Docker CLI behavior Signed-off-by: Joffrey F --- tests/unit/utils_test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/unit/utils_test.py') diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 00456e8..467e835 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -887,12 +887,22 @@ class ExcludePathsTest(unittest.TestCase): ) ) + def test_double_wildcard_with_exception(self): + assert self.exclude(['**', '!bar', '!foo/bar']) == convert_paths( + set([ + 'foo/bar', 'foo/bar/a.py', 'bar', 'bar/a.py', 'Dockerfile', + '.dockerignore', + ]) + ) + def test_include_wildcard(self): + # This may be surprising but it matches the CLI's behavior + # (tested with 18.05.0-ce on linux) base = make_tree(['a'], ['a/b.py']) assert exclude_paths( base, ['*', '!*/b.py'] - ) == convert_paths(['a/b.py']) + ) == set() def test_last_line_precedence(self): base = make_tree( -- cgit v1.2.1