patchew-project / patchew

A patch email tracking and testing system
MIT License
73 stars 24 forks source link

Reset "testing failed" state when manually reseting all failed tests #61

Closed famz closed 5 years ago

famz commented 6 years ago

When admin/maintainer click the Reset testing states of '...' button, resulting in all failed tests restarted, the overall testing failed state (represented by the red "T" flag) should be reset too.

bonzini commented 6 years ago

@famz, I think this is fixed by the results refactoring. Can you check?

famz commented 6 years ago

Resetting an individual test state is actually broken. In

    def clear_and_start_testing(self, obj, test=""):
        for k in list(obj.get_properties().keys()):
            if k == "testing.done" or \
               k == "testing.tested-head":
                obj.set_property(k, None)
        for r in self.get_testing_results(obj):
            r.delete()
        self.recalc_pending_tests(obj)

test parameter is not used!

bonzini commented 6 years ago

Oops, should be something like

diff --git a/mods/testing.py b/mods/testing.py
index 82b8c80..ccdd336 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -164,8 +164,13 @@ class TestingModule(PatchewModule):
             if k == "testing.done" or \
                k == "testing.tested-head":
                 obj.set_property(k, None)
-        for r in self.get_testing_results(obj):
-            r.delete()
+        if test:
+            r = self.get_testing_result(obj, test)
+            if r:
+                r.delete()
+        else:
+            for r in self.get_testing_results(obj):
+                r.delete()
         self.recalc_pending_tests(obj)

  def www_view_testing_reset(self, request, project_or_series):

(totally untested).

famz commented 6 years ago

Yeah, I'll write a test for it.

bonzini commented 5 years ago

Fixed now. The issue mentioned in the comments was fixed in commit d2576e8acc640ec79149d93fe8a7184a75cef876.