#NEWLINE# @ patch ( 'nefertari.engine.resolve' ) #NEWLINE# def test_multiple_engines( self , mock_resolve ) : #NEWLINE# #INDENT# from nefertari import engine #NEWLINE# foo = Mock ( ) #NEWLINE# bar = Mock ( ) #NEWLINE# foo . __all__ = [ 'one' , 'two' ] #NEWLINE# bar . __all__ = [ 'three' , 'four' ] #NEWLINE# config = Mock ( ) #NEWLINE# config . registry . settings = { #NEWLINE# #INDENT# 'nefertari.engine' : [ 'foo' , 'bar' ] , #NEWLINE# #UNINDENT# } #NEWLINE# mock_resolve . side_effect = ( lambda m : ( foo if ( m == 'foo' ) else bar ) ) #NEWLINE# engine . includeme ( config ) #NEWLINE# config . include . assert_any_call ( 'foo' ) #NEWLINE# config . include . assert_any_call ( 'bar' ) #NEWLINE# mock_resolve . assert_any_call ( 'foo' ) #NEWLINE# mock_resolve . assert_any_call ( 'bar' ) #NEWLINE# assert ( not hasattr ( engine , 'three' ) ) #NEWLINE# assert ( not hasattr ( engine , 'four' ) ) #NEWLINE# assert hasattr ( engine , 'one' ) #NEWLINE# assert hasattr ( engine , 'two' ) #NEWLINE# assert ( engine . engines == ( mock_resolve , bar ) )