diff --git a/pydrive2/test/test_util.py b/pydrive2/test/test_util.py index 8e324d15..4c70988f 100644 --- a/pydrive2/test/test_util.py +++ b/pydrive2/test/test_util.py @@ -48,8 +48,14 @@ def _call_once(call, *args, **kwargs): try: return call(*args, **kwargs) except ApiRequestError as exception: - if exception.error["code"] in [403, 500, 502, 503, 504]: - raise PyDriveRetriableError("Google API request failed") + code = exception.error["code"] + # Drive sometimes answers 409 Conflict to a delete right after the + # file changed. + conflict = code == 409 and exception.GetField("reason") == "conflict" + if conflict or code in [403, 500, 502, 503, 504]: + raise PyDriveRetriableError( + f"Google API request failed: {exception}" + ) from exception raise