[Patchew-devel] [PATCH 2/3] testing: Recalculate pending tests after disabling tests
Fam Zheng
famz at redhat.com
Wed Oct 31 01:24:28 UTC 2018
Signed-off-by: Fam Zheng <famz at redhat.com>
---
mods/testing.py | 6 ++++++
tests/test_testing.py | 19 +++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/mods/testing.py b/mods/testing.py
index 2d0ed0f..44e8822 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -453,6 +453,12 @@ class TestingGetView(APILoginRequiredView):
# Shouldn't happen, but let's protect against it
if not t:
continue
+ if not t.get("enabled"):
+ if isinstance(r, MessageResult):
+ _instance.recalc_pending_tests(r.message)
+ else:
+ _instance.recalc_pending_tests(r.project)
+ continue
reqs = t.get("requirements", "")
for req in [x.strip() for x in reqs.split(",") if x]:
if req not in capabilities:
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"))
+class TestingDisableTest(PatchewTestCase):
+
+ def setUp(self):
+ self.create_superuser()
+
+ self.repo = self.create_git_repo("repo")
+
+ self.p1 = self.add_project("QEMU", "qemu-devel at 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 = 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
--
2.17.2
More information about the Patchew-devel
mailing list