From 4c8d86c1d97535624f44cf020c681c80634de1ef Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Wed, 30 May 2018 14:53:10 -0700 Subject: [PATCH] bot lib tests: Move tests of bot library to tests/. This makes it clearer which files are for writing bot tests vs tests of the infrastructure. --- tools/run-mypy | 2 +- tools/test-lib | 4 ++-- zulip_bots/zulip_bots/{lib_tests.py => tests/test_lib.py} | 0 zulip_bots/zulip_bots/{ => tests}/test_run.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename zulip_bots/zulip_bots/{lib_tests.py => tests/test_lib.py} (100%) rename zulip_bots/zulip_bots/{ => tests}/test_run.py (98%) diff --git a/tools/run-mypy b/tools/run-mypy index 4b2d20e..6fdd16f 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -28,7 +28,7 @@ exclude = [ # Excluded out of laziness: "zulip_bots/zulip_bots/terminal.py", "zulip_bots/zulip_bots/simple_lib.py", - "zulip_bots/zulip_bots/lib_tests.py", + "zulip_bots/zulip_bots/tests/test_lib.py", "tools", ] diff --git a/tools/test-lib b/tools/test-lib index 7c1bc2e..18cc6f7 100755 --- a/tools/test-lib +++ b/tools/test-lib @@ -31,8 +31,8 @@ def run_all(): cov.load() cov.start() - module = import_module('zulip_bots.lib_tests') - suite = unittest.defaultTestLoader.loadTestsFromModule(module) + module = 'zulip_bots/zulip_bots/tests/' + suite = unittest.defaultTestLoader.discover(module) suite = unittest.TestSuite([suite]) runner = unittest.TextTestRunner(verbosity=2) diff --git a/zulip_bots/zulip_bots/lib_tests.py b/zulip_bots/zulip_bots/tests/test_lib.py similarity index 100% rename from zulip_bots/zulip_bots/lib_tests.py rename to zulip_bots/zulip_bots/tests/test_lib.py diff --git a/zulip_bots/zulip_bots/test_run.py b/zulip_bots/zulip_bots/tests/test_run.py similarity index 98% rename from zulip_bots/zulip_bots/test_run.py rename to zulip_bots/zulip_bots/tests/test_run.py index 890210b..326e99a 100644 --- a/zulip_bots/zulip_bots/test_run.py +++ b/zulip_bots/zulip_bots/tests/test_run.py @@ -14,7 +14,7 @@ from unittest.mock import patch class TestDefaultArguments(TestCase): our_dir = os.path.dirname(__file__) - path_to_bot = os.path.abspath(os.path.join(our_dir, 'bots/giphy/giphy.py')) + path_to_bot = os.path.abspath(os.path.join(our_dir, '../bots/giphy/giphy.py')) @patch('sys.argv', ['zulip-run-bot', 'giphy', '--config-file', '/foo/bar/baz.conf']) @patch('zulip_bots.run.run_message_handler_for_bot')