mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-82916: Don't fail when importing from / with sys.pycache_prefix set (GH-30456) (GH-137906)
(cherry picked from commit d8a9466e29)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
0accda7468
commit
ddd1264469
3 changed files with 16 additions and 1 deletions
|
|
@ -580,6 +580,18 @@ def test_cache_from_source_respects_pycache_prefix_relative(self):
|
|||
self.util.cache_from_source(path, optimization=''),
|
||||
os.path.normpath(expect))
|
||||
|
||||
@unittest.skipIf(sys.implementation.cache_tag is None,
|
||||
'requires sys.implementation.cache_tag to not be None')
|
||||
def test_cache_from_source_in_root_with_pycache_prefix(self):
|
||||
# Regression test for gh-82916
|
||||
pycache_prefix = os.path.join(os.path.sep, 'tmp', 'bytecode')
|
||||
path = 'qux.py'
|
||||
expect = os.path.join(os.path.sep, 'tmp', 'bytecode',
|
||||
f'qux.{self.tag}.pyc')
|
||||
with util.temporary_pycache_prefix(pycache_prefix):
|
||||
with os_helper.change_cwd('/'):
|
||||
self.assertEqual(self.util.cache_from_source(path), expect)
|
||||
|
||||
@unittest.skipIf(sys.implementation.cache_tag is None,
|
||||
'requires sys.implementation.cache_tag to not be None')
|
||||
def test_source_from_cache_inside_pycache_prefix(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue