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