GH-130608: Remove dirs_exist_ok argument from pathlib.Path.copy() (#130610)

This feature isn't sufficiently motivated.
This commit is contained in:
Barney Gale 2025-02-28 19:29:20 +00:00 committed by GitHub
parent fdcbc29f26
commit b545450961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 40 deletions

View file

@ -1495,23 +1495,6 @@ def test_copy_dir_to_existing_directory(self):
target.joinpath('dirD').mkdir()
self.assertRaises(FileExistsError, source.copy, target)
def test_copy_dir_to_existing_directory_dirs_exist_ok(self):
base = self.cls(self.base)
source = base / 'dirC'
target = base / 'copyC'
target.mkdir()
target.joinpath('dirD').mkdir()
result = source.copy(target, dirs_exist_ok=True)
self.assertEqual(result, target)
self.assertTrue(result.info.is_dir())
self.assertTrue(result.joinpath('dirD').info.is_dir())
self.assertTrue(result.joinpath('dirD', 'fileD').info.is_file())
self.assertEqual(result.joinpath('dirD', 'fileD').read_text(),
"this is file D\n")
self.assertTrue(result.joinpath('fileC').info.is_file())
self.assertTrue(result.joinpath('fileC').read_text(),
"this is file C\n")
def test_copy_dir_to_itself(self):
base = self.cls(self.base)
source = base / 'dirC'