#NEWLINE# def test_get_vf_state_fail( self ) : #NEWLINE# #INDENT# with mock . patch . object ( self . pci_wrapper , '_as_root' ) as mock_as_root : #NEWLINE# #INDENT# mock_as_root . side_effect = Exception ( ) #NEWLINE# self . assertRaises ( exc . IpCommandDeviceError , self . pci_wrapper . get_vf_state , self . VF_INDEX )