diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-08-18 08:23:10 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-08-18 08:23:10 (GMT) |
commit | 61732853616186123df12d4f3e360b9b4e0c69a0 (patch) | |
tree | 0c4a5f0a7468ad388642696d657679971e3366ad /Lib/distutils/tests | |
parent | de550558ca494402996ea14b5e6b62ce1e3b51f6 (diff) | |
download | cpython-61732853616186123df12d4f3e360b9b4e0c69a0.zip cpython-61732853616186123df12d4f3e360b9b4e0c69a0.tar.gz cpython-61732853616186123df12d4f3e360b9b4e0c69a0.tar.bz2 |
Merged revisions 74501 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74501 | tarek.ziade | 2009-08-18 10:16:33 +0200 (Tue, 18 Aug 2009) | 1 line
added more test coverage for distutils.filelist to prevent regressions when fnmatch or re are changed
........
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r-- | Lib/distutils/tests/test_filelist.py | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_filelist.py b/Lib/distutils/tests/test_filelist.py index 1faccfa..cf64c74 100644 --- a/Lib/distutils/tests/test_filelist.py +++ b/Lib/distutils/tests/test_filelist.py @@ -1,6 +1,21 @@ """Tests for distutils.filelist.""" +from os.path import join import unittest -from distutils.filelist import glob_to_re +from distutils.filelist import glob_to_re, FileList + +MANIFEST_IN = """\ +include ok +include xo +exclude xo +include foo.tmp +global-include *.x +global-include *.txt +global-exclude *.tmp +recursive-include f *.oo +recursive-exclude global *.x +graft dir +prune dir3 +""" class FileListTestCase(unittest.TestCase): @@ -16,6 +31,34 @@ class FileListTestCase(unittest.TestCase): self.assertEquals(glob_to_re('foo????'), r'foo[^/][^/][^/][^/]\Z(?ms)') self.assertEquals(glob_to_re(r'foo\\??'), r'foo\\\\[^/][^/]\Z(?ms)') + def test_process_template_line(self): + # testing all MANIFEST.in template patterns + file_list = FileList() + + # simulated file list + file_list.allfiles = ['foo.tmp', 'ok', 'xo', 'four.txt', + join('global', 'one.txt'), + join('global', 'two.txt'), + join('global', 'files.x'), + join('global', 'here.tmp'), + join('f', 'o', 'f.oo'), + join('dir', 'graft-one'), + join('dir', 'dir2', 'graft2'), + join('dir3', 'ok'), + join('dir3', 'sub', 'ok.txt') + ] + + for line in MANIFEST_IN.split('\n'): + if line.strip() == '': + continue + file_list.process_template_line(line) + + wanted = ['ok', 'four.txt', join('global', 'one.txt'), + join('global', 'two.txt'), join('f', 'o', 'f.oo'), + join('dir', 'graft-one'), join('dir', 'dir2', 'graft2')] + + self.assertEquals(file_list.files, wanted) + def test_suite(): return unittest.makeSuite(FileListTestCase) |