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

zulip_bots: Fix get_storage request arguments in StateHandler. #446

Merged
merged 2 commits into from
Jul 1, 2018

Conversation

shubhamdhama
Copy link
Member

I tried running connect_four game and it failed with these errors:

Traceback (most recent call last):
  File "/home/klitzy/python-zulip-api/zulip-api-py3-venv/bin/zulip-run-bot", line 11, in <module>
    load_entry_point('zulip-bots', 'console_scripts', 'zulip-run-bot')()
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/run.py", line 123, in main
    bot_name=bot_name
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/lib.py", line 300, in run_message_handler_for_bot
    message_handler = prepare_message_handler(bot_name, restricted_client, lib_module)
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/lib.py", line 263, in prepare_message_handler
    message_handler.initialize(bot_handler=bot_handler)
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/game_handler.py", line 180, in initialize
    self.get_user_cache()
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/game_handler.py", line 642, in get_user_cache
    user_cache_str = self.bot_handler.storage.get('users')
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/lib.py", line 72, in get
    response = self._client.get_storage(keys=(key,))
TypeError: get_storage() got an unexpected keyword argument 'keys'

@showell
Copy link
Contributor

showell commented Jun 28, 2018

It seems like the first commit introduces keys when the message only says you're renaming a test. Can you rebase to make that clean (and run tests locally after the first commit to make sure it's atomic).

I'm also curious what the history is here. Were you testing this against dev/master or czo?

@shubhamdhama
Copy link
Member Author

shubhamdhama commented Jun 28, 2018

I was testing in dev env, actually, I was debugging the issue reported by Jessica in #issues so I was trying to reproduce it with other bots. I found bot server exited with the error (fixed in this PR) with pip package first, then reproduced it PZA master branch.

It seems like the first commit introduces keys when the message only says you're renaming a test. Can you rebase to make that clean (and run tests locally after the first commit to making sure it's atomic).

It's because of this line aad9ced#diff-5db543d6b799cdac9921eaa52303e294R73
So to make the test pass for the first commit I've added this.
otherwise I'm getting this error:


======================================================================
ERROR: test_state_handler (test_lib.LibTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/tests/test_lib.py", line 73, in test_state_handler
    val = state_handler.get('key')
  File "/home/klitzy/python-zulip-api/zulip_bots/zulip_bots/lib.py", line 72, in get
    response = self._client.get_storage(keys=(key,))
TypeError: get_storage() got an unexpected keyword argument 'keys'

----------------------------------------------------------------------

@showell showell merged commit 918e63a into zulip:master Jul 1, 2018
@showell
Copy link
Contributor

showell commented Jul 1, 2018

Merged, thanks @shubhamdhama!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants