summaryrefslogtreecommitdiff
path: root/tests/unit/utils_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-06-21 00:15:55 -0700
committerJoffrey F <joffrey@docker.com>2018-06-21 00:19:22 -0700
commit5af89904c9ad33b632305b53058ddc69190f56a9 (patch)
treede0201e6e7a945503da14a0e21f21c6d491d7816 /tests/unit/utils_test.py
parent5a85cad54785bae45787b2584476c286301329e2 (diff)
downloaddocker-py-c6024-improved_excludes.tar.gz
Improved .dockerignore pattern processing to better match Docker CLI behaviorc6024-improved_excludes
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/unit/utils_test.py')
-rw-r--r--tests/unit/utils_test.py12
1 files changed, 11 insertions, 1 deletions
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(