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 slow_watch_mock #1962

Merged
merged 2 commits into from
Aug 13, 2022
Merged

Fix slow_watch_mock #1962

merged 2 commits into from
Aug 13, 2022

Conversation

jkawamoto
Copy link
Contributor

This PR fixes "TypeError: 'NoneType' object is not iterable" mentioned in #1959 (comment).

This error happens because Watcher._run expects the Watch callable object returns an iterable:

python-etcd3/etcd3/watch.py

Lines 128 to 136 in e78000e

def _run(self):
callback_err = None
try:
response_iter = self._watch_stub.Watch(
_new_request_iter(self._request_queue),
credentials=self._credentials,
metadata=self._metadata)
for rs in response_iter:
self._handle_response(rs)

but slow_watch_mock, which is used in test_watch_timeout_on_establishment returns nothing:

def slow_watch_mock(*args, **kwargs):
time.sleep(4)
foo_etcd.watcher._watch_stub.Watch = slow_watch_mock # noqa

This PR modifies slow_watch_mock to return an empty list to avoid the type error.

Also, it updates Dockerfile to use Python 3.9 and newer etcd.

slow_watch_mock returns nothing, but Watcher._run expects a Watch
object returns an iterable. This causes "TypeError: 'NoneType' object
is not iterable" mentioned in
kragniz#1959 (comment)
This commit modifies slow_watch_mock so that it returns an empty list
to avoid the type error.
@kragniz
Copy link
Owner

kragniz commented Aug 13, 2022

Thanks!

@kragniz kragniz merged commit 44544b3 into kragniz:master Aug 13, 2022
@jkawamoto jkawamoto deleted the fix_slow_watch_mock branch September 5, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants