cpython (3.4): Issue #22665: Add missing get_terminal_size and SameFileError to shutil.__all__.
![](https://secure.gravatar.com/avatar/8ac615df352a970211b0e3d94a307c6d.jpg?s=120&d=mm&r=g)
https://hg.python.org/cpython/rev/232520144c6c changeset: 93329:232520144c6c branch: 3.4 parent: 93324:147518a95b60 user: Berker Peksag <berker.peksag@gmail.com> date: Sat Nov 01 11:04:06 2014 +0200 summary: Issue #22665: Add missing get_terminal_size and SameFileError to shutil.__all__. files: Lib/shutil.py | 3 ++- Lib/test/test_shutil.py | 18 ++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 23 insertions(+), 1 deletions(-) diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -36,7 +36,8 @@ "register_archive_format", "unregister_archive_format", "get_unpack_formats", "register_unpack_format", "unregister_unpack_format", "unpack_archive", - "ignore_patterns", "chown", "which"] + "ignore_patterns", "chown", "which", "get_terminal_size", + "SameFileError"] # disk_usage is added later, if available on the platform class Error(OSError): diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1762,5 +1762,23 @@ self.assertEqual(expected, actual) +class PublicAPITests(unittest.TestCase): + """Ensures that the correct values are exposed in the public API.""" + + def test_module_all_attribute(self): + self.assertTrue(hasattr(shutil, '__all__')) + target_api = ['copyfileobj', 'copyfile', 'copymode', 'copystat', + 'copy', 'copy2', 'copytree', 'move', 'rmtree', 'Error', + 'SpecialFileError', 'ExecError', 'make_archive', + 'get_archive_formats', 'register_archive_format', + 'unregister_archive_format', 'get_unpack_formats', + 'register_unpack_format', 'unregister_unpack_format', + 'unpack_archive', 'ignore_patterns', 'chown', 'which', + 'get_terminal_size', 'SameFileError'] + if hasattr(os, 'statvfs') or os.name == 'nt': + target_api.append('disk_usage') + self.assertEqual(set(shutil.__all__), set(target_api)) + + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -33,6 +33,9 @@ Library ------- +- Issue #22665: Add missing get_terminal_size and SameFileError to + shutil.__all__. + - Issue #17381: Fixed handling of case-insensitive ranges in regular expressions. -- Repository URL: https://hg.python.org/cpython
participants (1)
-
berker.peksag