changeset: 93330:193ac288bc7f parent: 93328:ec196a99af8d parent: 93329:232520144c6c user: Berker Peksag date: Sat Nov 01 11:05:36 2014 +0200 files: Lib/shutil.py Lib/test/test_shutil.py Misc/NEWS description: Issue #22665: Add missing get_terminal_size and SameFileError to shutil.__all__. diff -r ec196a99af8d -r 193ac288bc7f Lib/shutil.py --- a/Lib/shutil.py Sat Nov 01 10:45:57 2014 +0200 +++ b/Lib/shutil.py Sat Nov 01 11:05:36 2014 +0200 @@ -42,7 +42,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 -r ec196a99af8d -r 193ac288bc7f Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py Sat Nov 01 10:45:57 2014 +0200 +++ b/Lib/test/test_shutil.py Sat Nov 01 11:05:36 2014 +0200 @@ -1788,5 +1788,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 -r ec196a99af8d -r 193ac288bc7f Misc/NEWS --- a/Misc/NEWS Sat Nov 01 10:45:57 2014 +0200 +++ b/Misc/NEWS Sat Nov 01 11:05:36 2014 +0200 @@ -180,6 +180,9 @@ Library ------- +- Issue #22665: Add missing get_terminal_size and SameFileError to + shutil.__all__. + - Issue #6623: Remove deprecated Netrc class in the ftplib module. Patch by Matt Chaput.