test_security_set: detect missing xml support v2.2.0_alpha155
authorZac Medico <zmedico@gentoo.org>
Sat, 19 Jan 2013 07:04:53 +0000 (23:04 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 19 Jan 2013 07:04:53 +0000 (23:04 -0800)
pym/portage/tests/glsa/test_security_set.py

index 7b209f42946d0859fa3d6da826a5bf89c4931128..edf5678092f7832e5372296dec3855b343672ae8 100644 (file)
@@ -58,8 +58,21 @@ class SecuritySetTestCase(TestCase):
 </glsa>
 """
 
+       def _must_skip(self):
+               try:
+                       __import__("xml.etree.ElementTree")
+                       __import__("xml.parsers.expat").parsers.expat.ExpatError
+               except (AttributeError, ImportError):
+                       return "python is missing xml support"
+
        def testSecuritySet(self):
 
+               skip_reason = self._must_skip()
+               if skip_reason:
+                       self.portage_skip = skip_reason
+                       self.assertFalse(True, skip_reason)
+                       return
+
                ebuilds = {
                        "cat/A-vulnerable-2.2": {
                                "KEYWORDS": "x86"