[3.12] gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065) (GH-119088)

(cherry picked from commit 0152dc4ff5)
This commit is contained in:
Serhiy Storchaka 2024-05-16 11:04:37 +03:00 committed by GitHub
parent ed395f5c0e
commit 33a9f0ce65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 116 additions and 128 deletions

View file

@ -265,14 +265,15 @@ class ZipAppTest(unittest.TestCase):
zipapp.create_archive(str(target), new_target, interpreter='python2.7')
self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n'))
def test_read_from_pathobj(self):
# Test that we can copy an archive using a pathlib.Path object
def test_read_from_pathlike_obj(self):
# Test that we can copy an archive using a path-like object
# for the source.
source = self.tmpdir / 'source'
source.mkdir()
(source / '__main__.py').touch()
target1 = self.tmpdir / 'target1.pyz'
target2 = self.tmpdir / 'target2.pyz'
source = os_helper.FakePath(str(source))
target1 = os_helper.FakePath(str(self.tmpdir / 'target1.pyz'))
target2 = os_helper.FakePath(str(self.tmpdir / 'target2.pyz'))
zipapp.create_archive(source, target1, interpreter='python')
zipapp.create_archive(target1, target2, interpreter='python2.7')
self.assertEqual(zipapp.get_interpreter(target2), 'python2.7')