<s> import os <EOL> from contextlib import contextmanager <EOL> from twitter . common . contextutil import environment_as , temporary_dir <EOL> from pex . pex_builder import PEXBuilder <EOL> from pex . testing import run_simple_pex <EOL> @ contextmanager <EOL> def write_and_run_simple_pex ( inheriting = False ) : <EOL> """<STR_LIT>""" <EOL> with temporary_dir ( ) as td : <EOL> pex_path = os . path . join ( td , '<STR_LIT>' ) <EOL> with open ( os . path . join ( td , '<STR_LIT>' ) , '<STR_LIT:w>' ) as fp : <EOL> fp . write ( '<STR_LIT>' ) <EOL> pb = PEXBuilder ( path = td , preamble = None ) <EOL> pb . info . inherit_path = inheriting <EOL> pb . set_executable ( os . path . join ( td , '<STR_LIT>' ) ) <EOL> pb . freeze ( ) <EOL> pb . build ( pex_path ) <EOL> with environment_as ( PEX_VERBOSE = '<STR_LIT:1>' ) : <EOL> yield run_simple_pex ( pex_path ) [ <NUM_LIT:0> ] <EOL> def test_inherits_path_option ( ) : <EOL> with write_and_run_simple_pex ( inheriting = True ) as so : <EOL> assert '<STR_LIT>' not in str ( so ) , '<STR_LIT>' <EOL> def test_does_not_inherit_path_option ( ) : <EOL> with write_and_run_simple_pex ( inheriting = False ) as so : <EOL> assert '<STR_LIT>' in str ( so ) , '<STR_LIT>' </s>
