@@ -240,9 +240,8 @@ def test_script_abspath(self):
240240 def test_script_compiled (self ):
241241 with os_helper .temp_dir () as script_dir :
242242 script_name = _make_test_script (script_dir , 'script' )
243- py_compile . compile (script_name , doraise = True )
243+ pyc_file = import_helper . make_legacy_pyc (script_name , allow_compile = True )
244244 os .remove (script_name )
245- pyc_file = import_helper .make_legacy_pyc (script_name )
246245 self ._check_script (pyc_file , pyc_file ,
247246 pyc_file , script_dir , None ,
248247 importlib .machinery .SourcelessFileLoader )
@@ -257,9 +256,8 @@ def test_directory(self):
257256 def test_directory_compiled (self ):
258257 with os_helper .temp_dir () as script_dir :
259258 script_name = _make_test_script (script_dir , '__main__' )
260- py_compile . compile (script_name , doraise = True )
259+ pyc_file = import_helper . make_legacy_pyc (script_name , allow_compile = True )
261260 os .remove (script_name )
262- pyc_file = import_helper .make_legacy_pyc (script_name )
263261 self ._check_script (script_dir , pyc_file , script_dir ,
264262 script_dir , '' ,
265263 importlib .machinery .SourcelessFileLoader )
@@ -279,8 +277,8 @@ def test_zipfile(self):
279277 def test_zipfile_compiled_timestamp (self ):
280278 with os_helper .temp_dir () as script_dir :
281279 script_name = _make_test_script (script_dir , '__main__' )
282- compiled_name = py_compile . compile (
283- script_name , doraise = True ,
280+ compiled_name = script_name + 'c'
281+ py_compile . compile ( script_name , compiled_name , doraise = True ,
284282 invalidation_mode = py_compile .PycInvalidationMode .TIMESTAMP )
285283 zip_name , run_name = make_zip_script (script_dir , 'test_zip' , compiled_name )
286284 self ._check_script (zip_name , run_name , zip_name , zip_name , '' ,
@@ -289,8 +287,8 @@ def test_zipfile_compiled_timestamp(self):
289287 def test_zipfile_compiled_checked_hash (self ):
290288 with os_helper .temp_dir () as script_dir :
291289 script_name = _make_test_script (script_dir , '__main__' )
292- compiled_name = py_compile . compile (
293- script_name , doraise = True ,
290+ compiled_name = script_name + 'c'
291+ py_compile . compile ( script_name , compiled_name , doraise = True ,
294292 invalidation_mode = py_compile .PycInvalidationMode .CHECKED_HASH )
295293 zip_name , run_name = make_zip_script (script_dir , 'test_zip' , compiled_name )
296294 self ._check_script (zip_name , run_name , zip_name , zip_name , '' ,
@@ -299,8 +297,8 @@ def test_zipfile_compiled_checked_hash(self):
299297 def test_zipfile_compiled_unchecked_hash (self ):
300298 with os_helper .temp_dir () as script_dir :
301299 script_name = _make_test_script (script_dir , '__main__' )
302- compiled_name = py_compile . compile (
303- script_name , doraise = True ,
300+ compiled_name = script_name + 'c'
301+ py_compile . compile ( script_name , compiled_name , doraise = True ,
304302 invalidation_mode = py_compile .PycInvalidationMode .UNCHECKED_HASH )
305303 zip_name , run_name = make_zip_script (script_dir , 'test_zip' , compiled_name )
306304 self ._check_script (zip_name , run_name , zip_name , zip_name , '' ,
@@ -353,9 +351,8 @@ def test_package_compiled(self):
353351 pkg_dir = os .path .join (script_dir , 'test_pkg' )
354352 make_pkg (pkg_dir )
355353 script_name = _make_test_script (pkg_dir , '__main__' )
356- compiled_name = py_compile . compile (script_name , doraise = True )
354+ pyc_file = import_helper . make_legacy_pyc (script_name , allow_compile = True )
357355 os .remove (script_name )
358- pyc_file = import_helper .make_legacy_pyc (script_name )
359356 self ._check_script (["-m" , "test_pkg" ], pyc_file ,
360357 pyc_file , script_dir , 'test_pkg' ,
361358 importlib .machinery .SourcelessFileLoader ,
0 commit comments