From nobody Fri Apr 19 21:41:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541057321891282.59298646955926; Thu, 1 Nov 2018 00:28:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA89B30917AF; Thu, 1 Nov 2018 07:28:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97CF1600D1; Thu, 1 Nov 2018 07:28:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 87EB44BB74; Thu, 1 Nov 2018 07:28:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA17DbLb012701 for ; Thu, 1 Nov 2018 03:13:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80E9A60F89; Thu, 1 Nov 2018 07:13:37 +0000 (UTC) Received: from magic.redhat.com (ovpn-12-172.pek2.redhat.com [10.72.12.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 282A460C62; Thu, 1 Nov 2018 07:13:32 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Thu, 1 Nov 2018 15:13:31 +0800 Message-Id: <20181101071331.25918-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH v3] testing: Recalculate pending tests after disabling tests X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 01 Nov 2018 07:28:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use Paolo's fix that updates all pending tests when project properties change. --- mods/testing.py | 17 +++++++++++++++-- tests/test_testing.py | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index 2d0ed0f..b3e4b07 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -130,7 +130,7 @@ class TestingModule(PatchewModule): self.clear_and_start_testing(obj) elif isinstance(obj, Project) and name.startswith("testing.tests."= ) \ and old_value !=3D value: - self.recalc_pending_tests(obj) + self.project_recalc_pending_tests(obj) =20 def on_result_update(self, evt, obj, old_status, result): if result.name.startswith("testing.") and result.status !=3D old_s= tatus: @@ -151,8 +151,11 @@ class TestingModule(PatchewModule): and result.data.get("tag") and result.data.get("repo"): self.clear_and_start_testing(obj) =20 + def filter_testing_results(self, queryset, *args, **kwargs): + return queryset.filter(name__startswith=3D'testing.', *args, **kwa= rgs) + def get_testing_results(self, obj, *args, **kwargs): - return obj.results.filter(name__startswith=3D'testing.', *args, **= kwargs) + return self.filter_testing_results(obj.results, *args, **kwargs) =20 def get_testing_result(self, obj, name): try: @@ -178,6 +181,16 @@ class TestingModule(PatchewModule): return obj.set_property("testing.done", True) =20 + def project_recalc_pending_tests(self, project): + self.recalc_pending_tests(project) + + # Only operate on messages for which testing has not completed yet. + message_ids =3D self.filter_testing_results(MessageResult.objects, + message__project=3Dproject, status=3DResult.PENDING).value= s('message_id') + messages =3D Message.objects.filter(id__in=3Dmessage_ids) + for obj in messages: + self.recalc_pending_tests(obj) + def clear_and_start_testing(self, obj, test=3D""): for k in list(obj.get_properties().keys()): if k =3D=3D "testing.done" or \ diff --git a/tests/test_testing.py b/tests/test_testing.py index c9452a4..6e960f1 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -348,6 +348,25 @@ class TestingResetTest(PatchewTestCase): "testing.c": Result.PENDING}) self.assertFalse(msg.get_property("testing.done")) =20 +class TestingDisableTest(PatchewTestCase): + + def setUp(self): + self.create_superuser() + + self.repo =3D self.create_git_repo("repo") + + self.p1 =3D self.add_project("QEMU", "qemu-devel@nongnu.org") + create_test(self.p1, "a") + + def test_disable_test(self): + self.cli_login() + self.cli_import('0013-foo-patch.mbox.gz') + self.do_apply() + self.p1.set_property("testing.tests.a.enabled", False) + out, err =3D self.check_cli(["tester", "-p", "QEMU", "--no-wait"]) + self.assertNotIn("Project: QEMU\n", out) + self.cli_logout() + # do not run tests on the abstract class del TestingTestCase =20 --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel