Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show a non-None error for core_exception.Unknown errors. #968

Merged
merged 3 commits into from
Mar 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for Unknown api errors.
  • Loading branch information
sorced-jim committed Mar 8, 2024
commit 2ff8b148debe92d831d2083b42459b4470f080b1
12 changes: 12 additions & 0 deletions tests/unit/test__retry.py
Expand Up @@ -98,6 +98,18 @@ def callback():
retry = _retry.retry_async(callback)
assert retry().exception() is error

@staticmethod
@pytest.mark.usefixtures("in_context")
def test_api_core_unknown():
def callback():
raise core_exceptions.Unknown("Unknown")

with pytest.raises(core_exceptions.RetryError) as e:
retry = _retry.retry_async(callback, retries=1)
retry().result()

assert e.value.cause == "google.api_core.exceptions.Unknown"

@staticmethod
@pytest.mark.usefixtures("in_context")
@mock.patch("google.cloud.ndb.tasklets.sleep")
Expand Down