#NEWLINE# def test_cpu_features_are_not_duplicated( self ) : #NEWLINE# #INDENT# self . host . get_connection ( ) #NEWLINE# with mock . patch ( 'nova.virt.libvirt.host.libvirt' ) as mock_libvirt : #NEWLINE# #INDENT# del mock_libvirt . VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES #NEWLINE# caps = self . host . get_capabilities ( ) #NEWLINE# cnt = [ x . name for x in caps . host . cpu . features ] . count ( 'xtpr' ) #NEWLINE# self . assertEqual ( 1 , cnt ) #NEWLINE# #UNINDENT# self . host . _caps = None #NEWLINE# with mock . patch ( 'nova.virt.libvirt.host.libvirt' ) as mock_libvirt : #NEWLINE# #INDENT# mock_libvirt [ 'VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES' ] = 1 #NEWLINE# caps = self . host . get_capabilities ( ) #NEWLINE# cnt = [ x . name for x in caps . host . cpu . features ] . count ( 'xtpr' ) #NEWLINE# self . assertEqual ( 1 , cnt )