#NEWLINE# @ mock . patch . object ( utils , 'udevadm_settle' ) #NEWLINE# @ mock . patch . object ( time , 'sleep' ) #NEWLINE# @ mock . patch . object ( utils , 'execute' ) #NEWLINE# def test_reread_partitions_device_busy( self , mock_exec , mock_sleep , mock_udev ) : #NEWLINE# #INDENT# mock_exec . return_value = ( '' , '' ) #NEWLINE# pu . reread_partitions ( '/dev/fake' , out = '_Device or resource busy_' ) #NEWLINE# mock_exec_expected = [ mock . call ( 'partprobe' , '/dev/fake' , check_exit_code = [ 0 , 1 ] ) ] #NEWLINE# self . assertEqual ( mock_exec . call_args_list , mock_exec_expected ) #NEWLINE# mock_sleep . assert_called_once_with ( 2 ) #NEWLINE# mock_udev . assert_called_once_with ( )