VMware: improve unit test time

A number of tests would invoke code that would sleep. This
patch adds a mocked function for the sleep.

Change-Id: I2d36bd456a11fcb7145baa5eb4c6875b9ec765d3
Closes-bug: #1280758
This commit is contained in:
Gary Kotton 2014-02-16 03:25:48 -08:00
parent fac4532c8f
commit 25a7899a3e

View File

@ -21,6 +21,7 @@ Test suite for VMwareAPI.
import contextlib
import copy
import time
import mock
import mox
@ -281,6 +282,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
return self.login_session
self.stubs.Set(vmwareapi_fake.FakeVim, '_login', _fake_login)
self.stubs.Set(time, 'sleep', lambda x: None)
self.conn = driver.VMwareAPISession()
self.assertEqual(self.attempts, 2)