[patchew-devel] [PATCH 5/7] testing: Use testing.ready property for project HEAD test

Fam Zheng posted 7 patches 7 years, 11 months ago
[patchew-devel] [PATCH 5/7] testing: Use testing.ready property for project HEAD test
Posted by Fam Zheng 7 years, 11 months ago
The previous conditions were broken: tests don't run after git head
moves. Adpot the "testing.ready" approach here too to fix it.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 mods/testing.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mods/testing.py b/mods/testing.py
index 80a22a5..ff07918 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -122,6 +122,10 @@ class TestingModule(PatchewModule):
             and obj.get_property("git.tag") and obj.get_property("git.repo"):
                 self.remove_testing_properties(obj)
                 obj.set_property("testing.ready", 1)
+        elif isinstance(obj, Project) and name == "git.head" \
+            and old_value != value:
+            self.remove_testing_properties(obj)
+            obj.set_property("testing.ready", 1)
 
     def remove_testing_properties(self, obj, test=""):
         for k in list(obj.get_properties().keys()):
@@ -428,6 +432,8 @@ class TestingGetView(APILoginRequiredView):
             obj.set_property("testing.done", True)
 
     def _find_project_test(self, request, po, tester, capabilities):
+        if not po.get_property("testing.ready"):
+            return
         head = po.get_property("git.head")
         repo = po.git
         tested = po.get_property("testing.tested-head")
-- 
2.14.3