views.dag: memoize() expensive graph drawing methods
[git-cola.git] / test / test_cola_imports.py
blobc3f06a3ff4ac595d91050fa7047df2b9abede1f0
1 #!/usr/bin/env python
2 """Tests the import-safety of leaf cola modules"""
3 import os
4 import imp
5 import unittest
8 class ColaImportTest(unittest.TestCase):
9 """Stub class used to hold the generated tests"""
10 pass
12 def _gen_test_method(themodule):
13 def import_test(self):
14 """This is not a docstring"""
15 mod = __import__(themodule)
16 self.failUnless(mod)
17 return import_test
19 def __create_tests():
20 for module in """cola.git
21 cola.observer
22 cola.settings
23 cola.controllers.bookmark
24 cola.controllers.classic
25 cola.controllers.compare
26 cola.controllers.createbranch
27 cola.controllers.main
28 cola.controllers.merge
29 cola.controllers.options
30 cola.controllers.remote
31 cola.controllers.repobrowser
32 cola.controllers.search
33 cola.controllers.selectcommits
34 cola.controllers.stash
35 cola.models.base
36 cola.models.compare
37 cola.models.gitrepo
38 cola.models.main
39 cola.models.observable
40 cola.models.search""".split():
41 method = _gen_test_method(module)
42 method.__doc__ = 'Test that we can import %s' % module
43 methodname = "test_" + module.replace('.', '_')
44 setattr(ColaImportTest, methodname, method)
45 __create_tests()
47 if __name__ == '__main__':
48 unittest.main()