#NEWLINE# def test_pip_installed_specific_env( self ) : #NEWLINE# #INDENT# venv_dir = os . path . join ( integration . TMP , 'pip-installed-specific-env' ) #NEWLINE# requirements_file = os . path . join ( integration . TMP_PRODENV_STATE_TREE , 'prod-env-requirements.txt' ) #NEWLINE# with salt . utils . fopen ( requirements_file , 'wb' ) as reqf : #NEWLINE# #INDENT# reqf . write ( 'pep8\n' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . run_function ( 'virtualenv.create' , [ venv_dir ] ) #NEWLINE# ret = self . run_state ( 'pip.installed' , name = '' , bin_env = venv_dir , requirements = 'salt://prod-env-requirements.txt' ) #NEWLINE# self . assertSaltFalseReturn ( ret ) #NEWLINE# self . assertInSaltComment ( "'salt://prod-env-requirements.txt' not found" , ret ) #NEWLINE# ret = self . run_state ( 'pip.installed' , name = '' , bin_env = venv_dir , saltenv = 'prod' , requirements = 'salt://prod-env-requirements.txt' ) #NEWLINE# self . assertSaltTrueReturn ( ret ) #NEWLINE# self . assertInSaltComment ( 'Successfully processed requirements file salt://prod-env-requirements.txt' , ret ) #NEWLINE# ret = self . run_state ( 'pip.installed' , name = '' , bin_env = venv_dir , requirements = 'salt://prod-env-requirements.txt?saltenv=prod' ) #NEWLINE# self . assertSaltTrueReturn ( ret ) #NEWLINE# self . assertInSaltComment ( 'Requirements were already installed.' , ret ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if os . path . isdir ( venv_dir ) : #NEWLINE# #INDENT# shutil . rmtree ( venv_dir ) #NEWLINE# #UNINDENT# if os . path . isfile ( requirements_file ) : #NEWLINE# #INDENT# os . unlink ( requirements_file )