views.dag: Add arrows to graph edges
[git-cola.git] / test / test_cola_imports.py
blob7c6bcffd61e3c182d7cc52af65404e02f9648d55
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.controllers.util
36 cola.models.base
37 cola.models.compare
38 cola.models.gitrepo
39 cola.models.main
40 cola.models.observable
41 cola.models.search""".split():
42 method = _gen_test_method(module)
43 method.__doc__ = 'Test that we can import %s' % module
44 methodname = "test_" + module.replace('.', '_')
45 setattr(ColaImportTest, methodname, method)
46 __create_tests()
48 if __name__ == '__main__':
49 unittest.main()