test/lint/test_import_modules.py: Better error reporting and expected failures
authorSebastian Luther <SebastianLuther@gmx.de>
Mon, 31 Jan 2011 07:30:26 +0000 (08:30 +0100)
committerZac Medico <zmedico@gentoo.org>
Wed, 2 Feb 2011 23:23:33 +0000 (15:23 -0800)
pym/portage/tests/lint/test_import_modules.py

index cee579a3a8488284f93fa790381d2ca8228c6d8c..c0551c7bea1ac6c8dbba04f3a00b3015a2b96455 100644 (file)
@@ -10,8 +10,17 @@ from portage import _unicode_decode
 class ImportModulesTestCase(TestCase):
 
        def testImportModules(self):
+               expected_failures = frozenset((
+                       "portage.cache.ebuild_xattr",   #automagic dep on xattr
+               ))
+
                for mod in self._list_modules(PORTAGE_PYM_PATH):
-                       __import__(mod)
+                       try:
+                               __import__(mod)
+                       except ImportError as e:
+                               if mod not in expected_failures:
+                                       self.assertTrue(False, "failed to import '%s': %s" % (mod, e))
+                               del e
 
        def _list_modules(self, base_dir):
                all_modules = []