#NEWLINE# def test_access_zipped_assets_integration( ) : #NEWLINE# #INDENT# test_executable = dedent ( "\n      import os\n      from _pex.util import DistributionHelper\n      temp_dir = DistributionHelper.access_zipped_assets('my_package', 'submodule')\n      with open(os.path.join(temp_dir, 'mod.py'), 'r') as fp:\n        for line in fp:\n          print(line)\n  " ) #NEWLINE# with nested ( temporary_dir ( ) , temporary_dir ( ) ) as ( td1 , td2 ) : #NEWLINE# #INDENT# pb = PEXBuilder ( path = td1 ) #NEWLINE# with open ( os . path . join ( td1 , 'exe.py' ) , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( test_executable ) #NEWLINE# pb . set_executable ( fp . name ) #NEWLINE# #UNINDENT# submodule = os . path . join ( td1 , 'my_package' , 'submodule' ) #NEWLINE# safe_mkdir ( submodule ) #NEWLINE# mod_path = os . path . join ( submodule , 'mod.py' ) #NEWLINE# with open ( mod_path , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( 'accessed' ) #NEWLINE# pb . add_source ( fp . name , 'my_package/submodule/mod.py' ) #NEWLINE# #UNINDENT# pex = os . path . join ( td2 , 'app.pex' ) #NEWLINE# pb . build ( pex ) #NEWLINE# ( output , returncode ) = run_simple_pex ( pex ) #NEWLINE# try : #NEWLINE# #INDENT# output = output . decode ( 'UTF-8' ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# assert ( output == 'accessed\n' ) #NEWLINE# assert ( returncode == 0 )