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:
parent
c636a5ac49
commit
6cdb83ce72
43 changed files with 105 additions and 102 deletions
|
@ -1,4 +1,4 @@
|
|||
from zulip_bots.test_lib import BotTestCase, read_bot_fixture_data
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, read_bot_fixture_data
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
@ -40,7 +40,7 @@ def mock_dialogflow(test_name: str, bot_name: str) -> Any:
|
|||
mock_text_request.return_value = request
|
||||
yield
|
||||
|
||||
class TestDialogFlowBot(BotTestCase):
|
||||
class TestDialogFlowBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'dialogflow'
|
||||
|
||||
def _test(self, test_name: str, message: str, response: str) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue