Pyolian tests: 2 small improvements
authorDave Andreoli <dave@gurumeditation.it>
Wed, 28 Nov 2018 19:16:19 +0000 (20:16 +0100)
committerHermet Park <hermetpark@gmail.com>
Wed, 5 Dec 2018 05:50:10 +0000 (14:50 +0900)
1. properly use unittest infra to skip tests, otherwise we will
   forgot the commented tests

2. split the new name collision test (failing, but really cool)
   so it have a proper name and the results are more readable

src/scripts/pyolian/eolian.py
src/scripts/pyolian/test_eolian.py

index 5a57676..49d288d 100644 (file)
@@ -389,7 +389,6 @@ class Eolian_Unit(EolianBaseObject):
         c_tdecl = lib.eolian_unit_alias_by_name_get(self, _str_to_bytes(name))
         return Typedecl(c_tdecl) if c_tdecl else None
 
-
     @property
     def all_namespaces(self):
         # TODO find a better way to find namespaces (maybe inside eolian?)
@@ -530,7 +529,6 @@ class Namespace(object):
         deep = self._name.count('.') + 1
         return [ ns for ns in self._unit.all_namespaces
                  if ns.name.startswith(base) and ns.name.count('.') == deep ]
-        
 
     @property
     def classes(self):
index 0ed27c2..a1ab85b 100755 (executable)
@@ -97,11 +97,11 @@ class TestEolianUnit(unittest.TestCase):
         self.assertIsInstance(unit, eolian.Eolian_Unit)
         self.assertEqual(unit.file, 'efl_ui_win.eo')
 
-    # Commented out until unit/state support is fixed
-    def test_children_listing(self):
-        l = list(eolian_db.children)
-        self.assertGreater(len(l), 500)
-        self.assertIsInstance(l[0], eolian.Eolian_Unit)
+    @unittest.skip('Skipped until unit/state support is fixed')
+    def test_children_listing(self):
+        l = list(eolian_db.children)
+        self.assertGreater(len(l), 500)
+        self.assertIsInstance(l[0], eolian.Eolian_Unit)
 
     def test_file_listing(self):
         l = list(eolian_db.eo_file_paths)
@@ -210,11 +210,14 @@ class TestEolianNamespace(unittest.TestCase):
         count = 0
         for ns in eolian_db.all_namespaces:
             self.assertIsInstance(ns, eolian.Namespace)
-            cls = eolian_db.class_by_name_get(ns.name)
-            self.assertIsNone(cls)
             count += 1
         self.assertGreater(count, 100)
 
+    def test_namespace_vs_class_collision(self):
+        for ns in eolian_db.all_namespaces:
+            cls = eolian_db.class_by_name_get(ns.name)
+            self.assertIsNone(cls)
+
     def test_namespace_equality(self):
         ns1 = eolian.Namespace(eolian_db, 'Efl.Io')
         ns2 = eolian.Namespace(eolian_db, 'Efl.Net')