#NEWLINE# def test_read_environ( self , get_config , config ) : #NEWLINE# #INDENT# config . initialized = False #NEWLINE# config_in_str = '\n{\n\'mycomponent\': {\n    \'__factory__\': \'palladium.tests.test_util.MyDummyComponent\',\n    \'arg1\': 3,\n    \'arg2\': "{}:{}".format(environ[\'PALLADIUM_DB_IP\'],\n                           environ[\'PALLADIUM_DB_PORT\']),\n    },\n}' #NEWLINE# with patch ( 'palladium.util.open' , mock_open ( read_data = config_in_str ) , create = True ) : #NEWLINE# #INDENT# with patch ( 'palladium.util.os.environ' , { #NEWLINE# #INDENT# 'PALLADIUM_CONFIG' : 'somepath' , #NEWLINE# 'PALLADIUM_DB_IP' : '192.168.0.1' , #NEWLINE# 'PALLADIUM_DB_PORT' : '666' , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# config_new = get_config ( ) #NEWLINE# #UNINDENT# mycomponent = config [ 'mycomponent' ] #NEWLINE# assert isinstance ( mycomponent , MyDummyComponent ) #NEWLINE# assert ( mycomponent . arg1 == 3 ) #NEWLINE# assert ( mycomponent . arg2 == '192.168.0.1:666' )