Re: [openstack-dev] Got Failure:"fixtures._fixtures.timeout.TimeoutException"
On Wed, Jun 08, 2016 at 01:29:49AM -0700, Clark Boylan wrote: > On Tue, Jun 7, 2016, at 10:40 PM, zhangshuai wrote: > > Hi all > > > > I have a question with fixtures._fixtures.timeout.TimeoutException. like > > following: > > > > > > > > > > Traceback (most recent call last): > > > > File "smaug/tests/fullstack/test_checkpoints.py", line 73, in > > test_checkpoint_create > > > > volume.id) > > > > File "smaug/tests/fullstack/test_checkpoints.py", line 51, in > > create_checkpoint > > > > sleep(640) > > > > File > > > > "/home/lexus/workspace/smaug/.tox/fullstack/local/lib/python2.7/site-packages/fixtures/_fixtures/timeout.py", > > line 52, in signal_handler > > > > raise TimeoutException() > > > > fixtures._fixtures.timeout.TimeoutException > > > > Ran 1 tests in 61.986s (-0.215s) > > > > FAILED (id=213, failures=1) > > > > > > > > error: testr failed (1) > > By default the bast test classes for many OpenStack projects implement a > 60 second unittest timeout. If the unittest takes longer than 60 seconds > an exception is raised and the test fails. I am guessing that smaug has > inherited this behavior which leads to the failure when you attempt to > sleep for 640 seconds. > > You can address this by either changing the timeout or making your test > run quicker. There's no need for sleeping in tests. Assuming this tests that something happens after 640 seconds, instead of actually sleeping for 640 seconds, you could instead mock the method that you get the time from, for example: mock.patch.object(time_module, 'time') def my_test(self, mock_time): mock_time.side_effect = [0, 640] test_a_thing() Note that (at least in the past) mocking time.time directly confuses testr and friends, so you may need some sort of wrapper around it like def _time(): return time.time() Though I think this has been fixed recently, so try it without the wrapper first. :) // jim > > Clark > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] Got Failure:"fixtures._fixtures.timeout.TimeoutException"
On Tue, Jun 7, 2016, at 10:40 PM, zhangshuai wrote: > Hi all > > I have a question with fixtures._fixtures.timeout.TimeoutException. like > following: > > > > > Traceback (most recent call last): > > File "smaug/tests/fullstack/test_checkpoints.py", line 73, in > test_checkpoint_create > > volume.id) > > File "smaug/tests/fullstack/test_checkpoints.py", line 51, in > create_checkpoint > > sleep(640) > > File > > "/home/lexus/workspace/smaug/.tox/fullstack/local/lib/python2.7/site-packages/fixtures/_fixtures/timeout.py", > line 52, in signal_handler > > raise TimeoutException() > > fixtures._fixtures.timeout.TimeoutException > > Ran 1 tests in 61.986s (-0.215s) > > FAILED (id=213, failures=1) > > > > error: testr failed (1) By default the bast test classes for many OpenStack projects implement a 60 second unittest timeout. If the unittest takes longer than 60 seconds an exception is raised and the test fails. I am guessing that smaug has inherited this behavior which leads to the failure when you attempt to sleep for 640 seconds. You can address this by either changing the timeout or making your test run quicker. Clark __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] Got Failure:"fixtures._fixtures.timeout.TimeoutException"
Hi all I have a question with fixtures._fixtures.timeout.TimeoutException. like following: Traceback (most recent call last): File "smaug/tests/fullstack/test_checkpoints.py", line 73, in test_checkpoint_create volume.id) File "smaug/tests/fullstack/test_checkpoints.py", line 51, in create_checkpoint sleep(640) File "/home/lexus/workspace/smaug/.tox/fullstack/local/lib/python2.7/site-packages/fixtures/_fixtures/timeout.py", line 52, in signal_handler raise TimeoutException() fixtures._fixtures.timeout.TimeoutException Ran 1 tests in 61.986s (-0.215s) FAILED (id=213, failures=1) error: testr failed (1)__ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev