summaryrefslogtreecommitdiff
path: root/tests/unit/utils_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-02-08 16:46:32 -0800
committerJoffrey F <joffrey@docker.com>2016-02-09 12:11:30 -0800
commit90760cfe1d971a88c55e52456558085af7e8680c (patch)
tree4d7d2ef534947044a28cfe3fdc3372ca0f6f226d /tests/unit/utils_test.py
parent575305fdba6c57f06d605920e01b5e1d6b952d3e (diff)
downloaddocker-py-926-ignored_dockerfiles.tar.gz
Never exclude Dockerfile from the build context.926-ignored_dockerfiles
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/unit/utils_test.py')
-rw-r--r--tests/unit/utils_test.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py
index df29b9d..a0a96bb 100644
--- a/tests/unit/utils_test.py
+++ b/tests/unit/utils_test.py
@@ -736,6 +736,7 @@ class ExcludePathsTest(base.BaseTestCase):
'foo/b.py',
'foo/bar/a.py',
'bar/a.py',
+ 'foo/Dockerfile3',
]
all_paths = set(dirs + files)
@@ -775,6 +776,14 @@ class ExcludePathsTest(base.BaseTestCase):
assert self.exclude(['*'], dockerfile='Dockerfile.alt') == \
set(['Dockerfile.alt', '.dockerignore'])
+ assert self.exclude(['*'], dockerfile='foo/Dockerfile3') == \
+ set(['foo/Dockerfile3', '.dockerignore'])
+
+ def test_exclude_dockerfile_child(self):
+ includes = self.exclude(['foo/'], dockerfile='foo/Dockerfile3')
+ assert 'foo/Dockerfile3' in includes
+ assert 'foo/a.py' not in includes
+
def test_single_filename(self):
assert self.exclude(['a.py']) == self.all_paths - set(['a.py'])
@@ -825,28 +834,31 @@ class ExcludePathsTest(base.BaseTestCase):
def test_directory(self):
assert self.exclude(['foo']) == self.all_paths - set([
'foo', 'foo/a.py', 'foo/b.py',
- 'foo/bar', 'foo/bar/a.py',
+ 'foo/bar', 'foo/bar/a.py', 'foo/Dockerfile3'
])
def test_directory_with_trailing_slash(self):
assert self.exclude(['foo']) == self.all_paths - set([
'foo', 'foo/a.py', 'foo/b.py',
- 'foo/bar', 'foo/bar/a.py',
+ 'foo/bar', 'foo/bar/a.py', 'foo/Dockerfile3'
])
def test_directory_with_single_exception(self):
assert self.exclude(['foo', '!foo/bar/a.py']) == self.all_paths - set([
- 'foo/a.py', 'foo/b.py', 'foo', 'foo/bar'
+ 'foo/a.py', 'foo/b.py', 'foo', 'foo/bar',
+ 'foo/Dockerfile3'
])
def test_directory_with_subdir_exception(self):
assert self.exclude(['foo', '!foo/bar']) == self.all_paths - set([
- 'foo/a.py', 'foo/b.py', 'foo'
+ 'foo/a.py', 'foo/b.py', 'foo',
+ 'foo/Dockerfile3'
])
def test_directory_with_wildcard_exception(self):
assert self.exclude(['foo', '!foo/*.py']) == self.all_paths - set([
- 'foo/bar', 'foo/bar/a.py', 'foo'
+ 'foo/bar', 'foo/bar/a.py', 'foo',
+ 'foo/Dockerfile3'
])
def test_subdirectory(self):