Skip to content

Commit

Permalink
Merge branch 'skb-dev' of https://github.com/LanceMaverick/skybeard-2
Browse files Browse the repository at this point in the history
…into skb-dev
  • Loading branch information
LanceMaverick committed Feb 3, 2017
2 parents 60b5849 + d842319 commit a918eb7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""The purpose of this test is too test that the config and beards imports
properly before the bot is run."""
import unittest
import importlib
from skybeard.utils import PythonPathContext

import config

class TestConfig(unittest.TestCase):
def test_import_all_beards_return_None(self):
for path in config.beard_paths:
with PythonPathContext(path):
for beard in config.beards:
try:
importlib.import_module(beard)
except ImportError:
pass

# Once the modules are imported (or not), reimporting will return only
# the module. If we get an ImportError here, then one of them has gone
# wrong

successfully_imported_modules = []
import_exceptions = []
for beard in config.beards:
try:
mod = importlib.import_module(beard)
successfully_imported_modules.append(mod)
except ImportError as e:
import_exceptions.append(e)

if import_exceptions:
self.fail("We got problems: {}".format("\n".join(str(e) for e in import_exceptions)))


if __name__ == '__main__':
unittest.main()

0 comments on commit a918eb7

Please sign in to comment.