From 9b67e94ba876d05e22848253c7d71c9dccc68950 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Thu, 25 May 2017 00:26:51 +0200 Subject: [PATCH] bots: Fix unit tests not running in Vagrant. `test-bots` would not run in Vagrant, displaying the error "ValueError: no such test method in : runTest" This was due to the `BotTestCase` class inheriting from the TestCase class, even though it was not a unit test on its own. This commit removes the inheritance of TestCase and specifies `test_define` as the `runTest` method in `TestDefineBot`. --- contrib_bots/bots/define/test_define.py | 2 +- contrib_bots/bots_test_lib.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib_bots/bots/define/test_define.py b/contrib_bots/bots/define/test_define.py index 770f1fd..fc67236 100644 --- a/contrib_bots/bots/define/test_define.py +++ b/contrib_bots/bots/define/test_define.py @@ -42,7 +42,7 @@ class TestDefineBot(TestCase): messages.append(message2) return messages - def test_define(self): + def runTest(self): # type: None -> None # Edit bot_module to test different bots, the below code can be looped for all the bots. bot_module = os.path.join(our_dir, "define.py") diff --git a/contrib_bots/bots_test_lib.py b/contrib_bots/bots_test_lib.py index 3d17463..14c5186 100644 --- a/contrib_bots/bots_test_lib.py +++ b/contrib_bots/bots_test_lib.py @@ -8,14 +8,13 @@ import sys import unittest from mock import MagicMock, patch -from unittest import TestCase from run import get_lib_module from bot_lib import StateHandler from contrib_bots import bot_lib from six.moves import zip -class BotTestCase(TestCase): +class BotTestCase(): def mock_test(self, messages, message_handler, bot_response): # type: (List[Dict[str, str]], Function) -> None