#NEWLINE# @ mock . patch ( 'nova.objects.InstancePCIRequests.get_by_instance_uuid' , return_value = objects . InstancePCIRequests ( requests = [ ] ) ) #NEWLINE# @ mock . patch ( 'nova.objects.Instance.save' ) #NEWLINE# def test_context_claim_with_exception( self , mock_save , mock_get ) : #NEWLINE# #INDENT# instance = self . _fake_instance_obj ( memory_mb = 1 , root_gb = 1 , ephemeral_gb = 1 ) #NEWLINE# try : #NEWLINE# #INDENT# with self . tracker . instance_claim ( self . context , instance ) : #NEWLINE# #INDENT# raise test . TestingException ( ) #NEWLINE# #UNINDENT# #UNINDENT# except test . TestingException : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertEqual ( 0 , self . tracker . compute_node . memory_mb_used ) #NEWLINE# self . assertEqual ( 0 , self . tracker . compute_node . local_gb_used ) #NEWLINE# self . assertEqual ( 0 , self . compute [ 'memory_mb_used' ] ) #NEWLINE# self . assertEqual ( 0 , self . compute [ 'local_gb_used' ] ) #NEWLINE# self . assertEqualNUMAHostTopology ( FAKE_VIRT_NUMA_TOPOLOGY , objects . NUMATopology . obj_from_db_obj ( self . compute [ 'numa_topology' ] ) )