summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2016-03-17 15:32:10 -0700
committerTim Burke <tim.burke@gmail.com>2016-03-17 15:43:45 -0700
commitd2bd2f0859cde8f15c70834e892aab06cd65a064 (patch)
treea1e5f3ba09c1f830356f6feba7e42ecd94e400e0
parent985c03820926a16b9592c8857379741c496a880b (diff)
downloadpython-swiftclient-d2bd2f0859cde8f15c70834e892aab06cd65a064.tar.gz
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
-rw-r--r--tests/unit/test_shell.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 59ed17d..7abfc5a 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,