From 9450442c8c3e69d6ec82dc9610fe7f8ee31181f2 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Fri, 6 Jan 2017 16:37:15 -0800 Subject: Accept / as a path separator in dockerignore patterns on all platforms Signed-off-by: Joffrey F --- tests/unit/utils_test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/unit/utils_test.py') diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 743d076..cf00616 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -780,6 +780,16 @@ class ExcludePathsTest(unittest.TestCase): ]) ) + @pytest.mark.skipif( + not IS_WINDOWS_PLATFORM, reason='Backslash patterns only on Windows' + ) + def test_directory_with_subdir_exception_win32_pathsep(self): + assert self.exclude(['foo', '!foo\\bar']) == convert_paths( + self.all_paths - set([ + 'foo/a.py', 'foo/b.py', 'foo', 'foo/Dockerfile3' + ]) + ) + def test_directory_with_wildcard_exception(self): assert self.exclude(['foo', '!foo/*.py']) == convert_paths( self.all_paths - set([ @@ -792,6 +802,14 @@ class ExcludePathsTest(unittest.TestCase): self.all_paths - set(['foo/bar', 'foo/bar/a.py']) ) + @pytest.mark.skipif( + not IS_WINDOWS_PLATFORM, reason='Backslash patterns only on Windows' + ) + def test_subdirectory_win32_pathsep(self): + assert self.exclude(['foo\\bar']) == convert_paths( + self.all_paths - set(['foo/bar', 'foo/bar/a.py']) + ) + class TarTest(unittest.TestCase): def test_tar_with_excludes(self): -- cgit v1.2.1