diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-09-02 01:16:32 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-09-02 01:16:32 (GMT) |
commit | 75fbf87d7367f23ecd400694d3e4ac65fda3cf1a (patch) | |
tree | 7e2d13de30b074b4a3f6d5f5de4c8bd5d4c1bc99 /Lib/distutils/tests | |
parent | 5c38cb2316aabf42c60e75f5eb6637c6f59c45cf (diff) | |
parent | 65e33192830c5960d6a9dcb264ad459c9831176f (diff) | |
download | cpython-75fbf87d7367f23ecd400694d3e4ac65fda3cf1a.zip cpython-75fbf87d7367f23ecd400694d3e4ac65fda3cf1a.tar.gz cpython-75fbf87d7367f23ecd400694d3e4ac65fda3cf1a.tar.bz2 |
Issue #12885: Merge with 3.5
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r-- | Lib/distutils/tests/test_filelist.py | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/Lib/distutils/tests/test_filelist.py b/Lib/distutils/tests/test_filelist.py index e82bc3d..e719198 100644 --- a/Lib/distutils/tests/test_filelist.py +++ b/Lib/distutils/tests/test_filelist.py @@ -6,8 +6,10 @@ from distutils import debug from distutils.log import WARN from distutils.errors import DistutilsTemplateError from distutils.filelist import glob_to_re, translate_pattern, FileList +from distutils import filelist -from test.support import captured_stdout, run_unittest +import test.support +from test.support import captured_stdout from distutils.tests import support MANIFEST_IN = """\ @@ -292,8 +294,40 @@ class FileListTestCase(support.LoggingSilencer, self.assertWarnings() -def test_suite(): - return unittest.makeSuite(FileListTestCase) +class FindAllTestCase(unittest.TestCase): + @test.support.skip_unless_symlink + def test_missing_symlink(self): + with test.support.temp_cwd(): + os.symlink('foo', 'bar') + self.assertEqual(filelist.findall(), []) + + def test_basic_discovery(self): + """ + When findall is called with no parameters or with + '.' as the parameter, the dot should be omitted from + the results. + """ + with test.support.temp_cwd(): + os.mkdir('foo') + file1 = os.path.join('foo', 'file1.txt') + test.support.create_empty_file(file1) + os.mkdir('bar') + file2 = os.path.join('bar', 'file2.txt') + test.support.create_empty_file(file2) + expected = [file2, file1] + self.assertEqual(sorted(filelist.findall()), expected) + + def test_non_local_discovery(self): + """ + When findall is called with another path, the full + path name should be returned. + """ + with test.support.temp_dir() as temp_dir: + file1 = os.path.join(temp_dir, 'file1.txt') + test.support.create_empty_file(file1) + expected = [file1] + self.assertEqual(filelist.findall(temp_dir), expected) + if __name__ == "__main__": - run_unittest(test_suite()) + unittest.main() |