test-bots: Extract test discovery out of conditional.
This (re?)-enables exclusion of bot names from eg. `test-bots`.
This commit is contained in:
parent
a5307b3771
commit
210caa4a60
|
@ -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:
|
||||
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 available_bots]
|
||||
for name in bots_to_test]
|
||||
|
||||
def filter_tests(tests):
|
||||
# type: (Union[TestSuite, TestCase]) -> TestSuite
|
||||
|
|
Loading…
Reference in a new issue