diff --git a/tools/test-bots b/tools/test-bots index c9a5618..a6342c0 100755 --- a/tools/test-bots +++ b/tools/test-bots @@ -69,20 +69,22 @@ def main(): cov.load() cov.start() - loader = unittest.defaultTestLoader - top_level = "zulip_bots/zulip_bots/bots/" if options.bots_to_test: bots_to_test = filter(lambda bot: bot not in options.exclude, options.bots_to_test) - # Should add a check here that __init__.py is absent if test_*.py is present? - test_suites = [loader.discover(top_level + name, top_level_dir=top_level) - for name in bots_to_test] else: - # Codecov seems to work only when using loader.discover. It failed to - # capture line executions for functions like loader.loadTestFromModule - # or loader.loadTestFromNames. - test_suites = [loader.discover(top_level + name, top_level_dir=top_level) - for name in available_bots] + bots_to_test = filter(lambda bot: bot not in options.exclude, + available_bots) + + # Should add a check here that __init__.py is absent if test_*.py is present? + + # Codecov seems to work only when using loader.discover. It failed to + # capture line executions for functions like loader.loadTestFromModule + # or loader.loadTestFromNames. + top_level = "zulip_bots/zulip_bots/bots/" + loader = unittest.defaultTestLoader + test_suites = [loader.discover(top_level + name, top_level_dir=top_level) + for name in bots_to_test] def filter_tests(tests): # type: (Union[TestSuite, TestCase]) -> TestSuite