@@ -760,75 +760,75 @@ def test_source_from_cache_path_like_arg(self):
760760
761761 @unittest .skipIf (sys .implementation .cache_tag is None ,
762762 'requires sys.implementation.cache_tag to not be None' )
763- def test_cache_from_source_respects_bytecode_prefix (self ):
764- # If bytecode_prefix is set, cache_from_source will return a bytecode
763+ def test_cache_from_source_respects_pycache_prefix (self ):
764+ # If pycache_prefix is set, cache_from_source will return a bytecode
765765 # path inside that directory (in a subdirectory mirroring the .py file's
766766 # path) rather than in a __pycache__ dir next to the py file.
767- bytecode_prefixes = [
767+ pycache_prefixes = [
768768 os .path .join (os .path .sep , 'tmp' , 'bytecode' ),
769769 os .path .join (os .path .sep , 'tmp' , '\u2603 ' ), # non-ASCII in path!
770770 os .path .join (os .path .sep , 'tmp' , 'trailing-slash' ) + os .path .sep ,
771771 ]
772772 drive = ''
773773 if os .name == 'nt' :
774774 drive = 'C:'
775- bytecode_prefixes = [
776- f'{ drive } { prefix } ' for prefix in bytecode_prefixes ]
777- bytecode_prefixes += [r'\\?\C:\foo' , r'\\localhost\c$\bar' ]
778- for bytecode_prefix in bytecode_prefixes :
779- with self .subTest (path = bytecode_prefix ):
775+ pycache_prefixes = [
776+ f'{ drive } { prefix } ' for prefix in pycache_prefixes ]
777+ pycache_prefixes += [r'\\?\C:\foo' , r'\\localhost\c$\bar' ]
778+ for pycache_prefix in pycache_prefixes :
779+ with self .subTest (path = pycache_prefix ):
780780 path = drive + os .path .join (
781781 os .path .sep , 'foo' , 'bar' , 'baz' , 'qux.py' )
782782 expect = os .path .join (
783- bytecode_prefix , 'foo' , 'bar' , 'baz' ,
783+ pycache_prefix , 'foo' , 'bar' , 'baz' ,
784784 'qux.{}.pyc' .format (self .tag ))
785- with util .temporary_bytecode_prefix ( bytecode_prefix ):
785+ with util .temporary_pycache_prefix ( pycache_prefix ):
786786 self .assertEqual (
787787 self .util .cache_from_source (path , optimization = '' ),
788788 expect )
789789
790790 @unittest .skipIf (sys .implementation .cache_tag is None ,
791791 'requires sys.implementation.cache_tag to not be None' )
792- def test_cache_from_source_respects_bytecode_prefix_relative (self ):
792+ def test_cache_from_source_respects_pycache_prefix_relative (self ):
793793 # If the .py path we are given is relative, we will resolve to an
794- # absolute path before prefixing with bytecode_prefix , to avoid any
794+ # absolute path before prefixing with pycache_prefix , to avoid any
795795 # possible ambiguity.
796- bytecode_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
796+ pycache_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
797797 path = os .path .join ('foo' , 'bar' , 'baz' , 'qux.py' )
798798 root = os .path .splitdrive (os .getcwd ())[0 ] + os .path .sep
799799 expect = os .path .join (
800- bytecode_prefix ,
800+ pycache_prefix ,
801801 os .path .relpath (os .getcwd (), root ),
802802 'foo' , 'bar' , 'baz' , f'qux.{ self .tag } .pyc' )
803- with util .temporary_bytecode_prefix ( bytecode_prefix ):
803+ with util .temporary_pycache_prefix ( pycache_prefix ):
804804 self .assertEqual (
805805 self .util .cache_from_source (path , optimization = '' ),
806806 expect )
807807
808808 @unittest .skipIf (sys .implementation .cache_tag is None ,
809809 'requires sys.implementation.cache_tag to not be None' )
810- def test_source_from_cache_inside_bytecode_prefix (self ):
811- # If bytecode_prefix is set and the cache path we get is inside it,
810+ def test_source_from_cache_inside_pycache_prefix (self ):
811+ # If pycache_prefix is set and the cache path we get is inside it,
812812 # we return an absolute path to the py file based on the remainder of
813- # the path within bytecode_prefix .
814- bytecode_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
815- path = os .path .join (bytecode_prefix , 'foo' , 'bar' , 'baz' ,
813+ # the path within pycache_prefix .
814+ pycache_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
815+ path = os .path .join (pycache_prefix , 'foo' , 'bar' , 'baz' ,
816816 f'qux.{ self .tag } .pyc' )
817817 expect = os .path .join (os .path .sep , 'foo' , 'bar' , 'baz' , 'qux.py' )
818- with util .temporary_bytecode_prefix ( bytecode_prefix ):
818+ with util .temporary_pycache_prefix ( pycache_prefix ):
819819 self .assertEqual (self .util .source_from_cache (path ), expect )
820820
821821 @unittest .skipIf (sys .implementation .cache_tag is None ,
822822 'requires sys.implementation.cache_tag to not be None' )
823- def test_source_from_cache_outside_bytecode_prefix (self ):
824- # If bytecode_prefix is set but the cache path we get is not inside
823+ def test_source_from_cache_outside_pycache_prefix (self ):
824+ # If pycache_prefix is set but the cache path we get is not inside
825825 # it, just ignore it and handle the cache path according to the default
826826 # behavior.
827- bytecode_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
827+ pycache_prefix = os .path .join (os .path .sep , 'tmp' , 'bytecode' )
828828 path = os .path .join ('foo' , 'bar' , 'baz' , '__pycache__' ,
829829 f'qux.{ self .tag } .pyc' )
830830 expect = os .path .join ('foo' , 'bar' , 'baz' , 'qux.py' )
831- with util .temporary_bytecode_prefix ( bytecode_prefix ):
831+ with util .temporary_pycache_prefix ( pycache_prefix ):
832832 self .assertEqual (self .util .source_from_cache (path ), expect )
833833
834834
0 commit comments