bot tests: Adjust TestCase inheritance to avoid need to skip/filter.

Previously the test-bots script filtered out base-class tests from
BotTestCase. With this change, BotTestCase continues to inherit from
unittest.TestCase, but the default test_* methods previously in this
class are now in a new DefaultTests class, which does not. Instead, each
bot needs to inherit from BotTestCase and DefaultTests *explicitly*.

This avoids the need to filter out the base-class tests, which
simplifies the test-bots script, and may ease any migration to eg.
pytest.

The DefaultTests class does require some non-implemented methods which
BotTestCase provides.
This commit is contained in:
neiljp (Neil Pilgrim) 2018-06-08 14:30:50 -07:00 committed by showell
parent c636a5ac49
commit 6cdb83ce72
43 changed files with 105 additions and 102 deletions

View file

@ -10,7 +10,7 @@ import zulip_bots.bots.merels.merels
import zulip_bots.test_lib
class TestFollowUpBot(zulip_bots.test_lib.BotTestCase):
class TestFollowUpBot(zulip_bots.test_lib.BotTestCase, DefaultTests):
bot_name = "merels"
def test_no_command(self):