From d2bd2f0859cde8f15c70834e892aab06cd65a064 Mon Sep 17 00:00:00 2001 From: Tim Burke <tim.burke@gmail.com> Date: Thu, 17 Mar 2016 15:32:10 -0700 Subject: [PATCH] Initialize delete_object mock *before* creating all the threads Previously, we'd occasionally get spurious failures like FAIL: test_delete_account (tests.unit.test_shell.TestShell) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../mock/mock.py", line 1721, in _inner return f(*args, **kw) File ".../mock/mock.py", line 1305, in patched return func(*args, **keywargs) File ".../tests/unit/test_shell.py", line 788, in test_delete_account response_dict={})], any_order=True) File ".../mock/mock.py", line 983, in assert_has_calls ), cause) File ".../six.py", line 718, in raise_from raise value AssertionError: (call(u'container', u'object', query_string=None, response_dict={}),) not all found in call list Related-Bug: #1539536 Related-Bug: #1480223 Change-Id: I810894545ca74d3b2f2dbde2d0388eb69c2ba710 --- tests/unit/test_shell.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py index 59ed17d6..7abfc5ae 100644 --- a/tests/unit/test_shell.py +++ b/tests/unit/test_shell.py @@ -778,6 +778,7 @@ class TestShell(unittest.TestCase): connection.return_value.attempts = 0 argv = ["", "delete", "--all"] connection.return_value.head_object.return_value = {} + connection.return_value.delete_object.return_value = None swiftclient.shell.main(argv) connection.return_value.delete_object.assert_has_calls([ mock.call('container', 'object', query_string=None,