소스 검색

Update testing.rst (#4046)

Without mocking the retry method of the task and actually setting Retry as side effect, raising an operational error within the task will not lead to a Retry exception but the original Exception to be thrown as the task is called directly.
Rico Moorman 7 년 전
부모
커밋
e37588fa66
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      docs/userguide/testing.rst

+ 3 - 2
docs/userguide/testing.rst

@@ -76,8 +76,9 @@ in this example:
                 name='Foo',
             )
 
-            # set a side effect on the patched method
-            # so that it raises the error we want.
+            # Set a side effect on the patched methods
+            # so that they raise the errors we want.
+            send_order_retry.side_effect = Retry()
             product_order.side_effect = OperationalError()
 
             with raises(Retry):