mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.13] gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065) (GH-119087)
(cherry picked from commit 0152dc4ff5
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
bca7fb0e7a
commit
1dc7fcd803
19 changed files with 115 additions and 127 deletions
|
@ -914,7 +914,7 @@ class TestCopyTree(BaseTest, unittest.TestCase):
|
|||
'test.txt')))
|
||||
|
||||
dst_dir = join(self.mkdtemp(), 'destination')
|
||||
shutil.copytree(pathlib.Path(src_dir), dst_dir, ignore=_ignore)
|
||||
shutil.copytree(FakePath(src_dir), dst_dir, ignore=_ignore)
|
||||
self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
|
||||
'test.txt')))
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ class TestArchives(BaseTest, unittest.TestCase):
|
|||
self.check_unpack_archive_with_converter(
|
||||
format, lambda path: path, **kwargs)
|
||||
self.check_unpack_archive_with_converter(
|
||||
format, pathlib.Path, **kwargs)
|
||||
format, FakePath, **kwargs)
|
||||
self.check_unpack_archive_with_converter(format, FakePath, **kwargs)
|
||||
|
||||
def check_unpack_archive_with_converter(self, format, converter, **kwargs):
|
||||
|
@ -2672,12 +2672,12 @@ class TestMove(BaseTest, unittest.TestCase):
|
|||
|
||||
def test_move_file_to_dir_pathlike_src(self):
|
||||
# Move a pathlike file to another location on the same filesystem.
|
||||
src = pathlib.Path(self.src_file)
|
||||
src = FakePath(self.src_file)
|
||||
self._check_move_file(src, self.dst_dir, self.dst_file)
|
||||
|
||||
def test_move_file_to_dir_pathlike_dst(self):
|
||||
# Move a file to another pathlike location on the same filesystem.
|
||||
dst = pathlib.Path(self.dst_dir)
|
||||
dst = FakePath(self.dst_dir)
|
||||
self._check_move_file(self.src_file, dst, self.dst_file)
|
||||
|
||||
@mock_rename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue