Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8083cd6

Browse files
committed
Issue #22665: Add missing get_terminal_size and SameFileError to shutil.__all__.
1 parent e1d26f3 commit 8083cd6

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

Lib/shutil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"register_archive_format", "unregister_archive_format",
3737
"get_unpack_formats", "register_unpack_format",
3838
"unregister_unpack_format", "unpack_archive",
39-
"ignore_patterns", "chown", "which"]
39+
"ignore_patterns", "chown", "which", "get_terminal_size",
40+
"SameFileError"]
4041
# disk_usage is added later, if available on the platform
4142

4243
class Error(OSError):

Lib/test/test_shutil.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,5 +1762,23 @@ def test_stty_match(self):
17621762
self.assertEqual(expected, actual)
17631763

17641764

1765+
class PublicAPITests(unittest.TestCase):
1766+
"""Ensures that the correct values are exposed in the public API."""
1767+
1768+
def test_module_all_attribute(self):
1769+
self.assertTrue(hasattr(shutil, '__all__'))
1770+
target_api = ['copyfileobj', 'copyfile', 'copymode', 'copystat',
1771+
'copy', 'copy2', 'copytree', 'move', 'rmtree', 'Error',
1772+
'SpecialFileError', 'ExecError', 'make_archive',
1773+
'get_archive_formats', 'register_archive_format',
1774+
'unregister_archive_format', 'get_unpack_formats',
1775+
'register_unpack_format', 'unregister_unpack_format',
1776+
'unpack_archive', 'ignore_patterns', 'chown', 'which',
1777+
'get_terminal_size', 'SameFileError']
1778+
if hasattr(os, 'statvfs') or os.name == 'nt':
1779+
target_api.append('disk_usage')
1780+
self.assertEqual(set(shutil.__all__), set(target_api))
1781+
1782+
17651783
if __name__ == '__main__':
17661784
unittest.main()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Core and Builtins
3333
Library
3434
-------
3535

36+
- Issue #22665: Add missing get_terminal_size and SameFileError to
37+
shutil.__all__.
38+
3639
- Issue #17381: Fixed handling of case-insensitive ranges in regular
3740
expressions.
3841

0 commit comments

Comments
 (0)