@@ -736,6 +736,7 @@ class ExcludePathsTest(base.BaseTestCase):
736
736
'foo/b.py' ,
737
737
'foo/bar/a.py' ,
738
738
'bar/a.py' ,
739
+ 'foo/Dockerfile3' ,
739
740
]
740
741
741
742
all_paths = set (dirs + files )
@@ -775,6 +776,14 @@ def test_exclude_custom_dockerfile(self):
775
776
assert self .exclude (['*' ], dockerfile = 'Dockerfile.alt' ) == \
776
777
set (['Dockerfile.alt' , '.dockerignore' ])
777
778
779
+ assert self .exclude (['*' ], dockerfile = 'foo/Dockerfile3' ) == \
780
+ set (['foo/Dockerfile3' , '.dockerignore' ])
781
+
782
+ def test_exclude_dockerfile_child (self ):
783
+ includes = self .exclude (['foo/' ], dockerfile = 'foo/Dockerfile3' )
784
+ assert 'foo/Dockerfile3' in includes
785
+ assert 'foo/a.py' not in includes
786
+
778
787
def test_single_filename (self ):
779
788
assert self .exclude (['a.py' ]) == self .all_paths - set (['a.py' ])
780
789
@@ -825,28 +834,31 @@ def test_wildcard_subdir_wildcard_filename(self):
825
834
def test_directory (self ):
826
835
assert self .exclude (['foo' ]) == self .all_paths - set ([
827
836
'foo' , 'foo/a.py' , 'foo/b.py' ,
828
- 'foo/bar' , 'foo/bar/a.py' ,
837
+ 'foo/bar' , 'foo/bar/a.py' , 'foo/Dockerfile3'
829
838
])
830
839
831
840
def test_directory_with_trailing_slash (self ):
832
841
assert self .exclude (['foo' ]) == self .all_paths - set ([
833
842
'foo' , 'foo/a.py' , 'foo/b.py' ,
834
- 'foo/bar' , 'foo/bar/a.py' ,
843
+ 'foo/bar' , 'foo/bar/a.py' , 'foo/Dockerfile3'
835
844
])
836
845
837
846
def test_directory_with_single_exception (self ):
838
847
assert self .exclude (['foo' , '!foo/bar/a.py' ]) == self .all_paths - set ([
839
- 'foo/a.py' , 'foo/b.py' , 'foo' , 'foo/bar'
848
+ 'foo/a.py' , 'foo/b.py' , 'foo' , 'foo/bar' ,
849
+ 'foo/Dockerfile3'
840
850
])
841
851
842
852
def test_directory_with_subdir_exception (self ):
843
853
assert self .exclude (['foo' , '!foo/bar' ]) == self .all_paths - set ([
844
- 'foo/a.py' , 'foo/b.py' , 'foo'
854
+ 'foo/a.py' , 'foo/b.py' , 'foo' ,
855
+ 'foo/Dockerfile3'
845
856
])
846
857
847
858
def test_directory_with_wildcard_exception (self ):
848
859
assert self .exclude (['foo' , '!foo/*.py' ]) == self .all_paths - set ([
849
- 'foo/bar' , 'foo/bar/a.py' , 'foo'
860
+ 'foo/bar' , 'foo/bar/a.py' , 'foo' ,
861
+ 'foo/Dockerfile3'
850
862
])
851
863
852
864
def test_subdirectory (self ):
0 commit comments