zulip / python-zulip-api

Python library for the Zulip API.
https://zulip.com/api/
Apache License 2.0
350 stars 352 forks source link

Bot tests are not being fully executed #402

Open neiljp opened 6 years ago

neiljp commented 6 years ago

Noticed first when exploring the use of pytest, which should work with unittest.TestCase - but it couldn't find a bot dependency (tweepy for twitpost). Then I noticed that this bot was not even being tested!

Cases so far:

neiljp commented 6 years ago

@zulipbot claim

neiljp commented 6 years ago

With some simplification and common methods for test discovery in test-bots, both test-bots [bot-names-in-bots-dir] and test-bots currently find 295 tests, with 14 failures.

This is after addition of many __init__.py files to bot directories, which the current discovery misses.

WIP PR incoming for this, likely tomorrow, though more work will be needed to fix the tests.

timabbott commented 6 years ago

Awesome, thanks for discovering this! I wonder what the right tooling method to prevent folks from adding bots without __init__.py files is...

neiljp commented 6 years ago

I'm currently working on fixing the bot tests.

I have an alternative solution for the test discovery which seems simpler in terms of identifying tests, though with the other issues found I will explore whether it is necessary. update My solution does at least error-out if the bot name is explicitly mentioned, which is likely to be used during bot development, so that may help?

Agreed that including detection of cases with no __init__.py files is definitely important to remedy!

neiljp commented 6 years ago

So master has the following, with different test discovery for each:

So far my branch:

There is now "just":

timabbott commented 6 years ago

Splitting merels bot tests as a separate issue seems very reasonable.

I merged all but the last commit, since they seemed reasonable and worked for me. Thanks for cleaning this up!

zulipbot commented 6 years ago

Hello @neiljp, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 14 days.

You can reclaim this issue or claim any other issue by commenting @zulipbot claim on that issue.

Thanks for your contributions, and hope to see you again soon!