From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2D44E1382C5 for ; Mon, 29 Mar 2021 04:44:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1EA07E0824; Mon, 29 Mar 2021 04:44:15 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5F320E0824 for ; Mon, 29 Mar 2021 04:44:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D2796335C78 for ; Mon, 29 Mar 2021 04:44:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1EADD5CF for ; Mon, 29 Mar 2021 04:44:11 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1616991983.f84d0e45ca4cda2674d3f47f51729a6a8d0c7600.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: repoman/lib/repoman/tests/simple/ X-VCS-Repository: proj/portage X-VCS-Files: repoman/lib/repoman/tests/simple/test_simple.py X-VCS-Directories: repoman/lib/repoman/tests/simple/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: f84d0e45ca4cda2674d3f47f51729a6a8d0c7600 X-VCS-Branch: master Date: Mon, 29 Mar 2021 04:44:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6112edfe-f03f-4e86-8e6f-af0c105f341f X-Archives-Hash: d67def3580e9eec86e8ee4cc1a3b6ba7 commit: f84d0e45ca4cda2674d3f47f51729a6a8d0c7600 Author: Zac Medico gentoo org> AuthorDate: Mon Mar 29 04:18:57 2021 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Mar 29 04:26:23 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f84d0e45 SimpleRepomanTestCase: compare QATracker results to expected values Signed-off-by: Zac Medico gentoo.org> repoman/lib/repoman/tests/simple/test_simple.py | 29 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/repoman/lib/repoman/tests/simple/test_simple.py b/repoman/lib/repoman/tests/simple/test_simple.py index 2439c936b..e64ba4f07 100644 --- a/repoman/lib/repoman/tests/simple/test_simple.py +++ b/repoman/lib/repoman/tests/simple/test_simple.py @@ -1,6 +1,7 @@ # Copyright 2011-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import collections import subprocess import time import types @@ -65,7 +66,20 @@ class RepomanRun(types.SimpleNamespace): return repoman_vars.exitcode result = _repoman_scan(*repoman_vars) returncode = _handle_result(*repoman_vars, result) - return {"returncode": returncode} + qawarnings = repoman_vars.vcs_settings.qatracker.qawarnings + warns = collections.defaultdict(list) + fails = collections.defaultdict(list) + for qacat, issues in repoman_vars.vcs_settings.qatracker.fails.items(): + if qacat in qawarnings: + warns[qacat].extend(issues) + else: + fails[qacat].extend(issues) + result = {"returncode": returncode} + if fails: + result["fails"] = fails + if warns: + result["warns"] = warns + return result class SimpleRepomanTestCase(TestCase): @@ -122,9 +136,9 @@ class SimpleRepomanTestCase(TestCase): self.assertFalse(True, skip_reason) return - copyright_header = """# Copyright 1999-%s Gentoo Foundation + copyright_header = """# Copyright 1999-%s Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -# $Header: $ + """ % time.gmtime().tm_year repo_configs = { @@ -278,6 +292,7 @@ class SimpleRepomanTestCase(TestCase): committer_name = "Gentoo Dev" committer_email = "gentoo-dev@gentoo.org" + expected_warnings = {"returncode": 0} git_test = ( ("", RepomanRun(args=["manifest"])), @@ -286,14 +301,14 @@ class SimpleRepomanTestCase(TestCase): ("", git_cmd + ("init-db",)), ("", git_cmd + ("add", ".")), ("", git_cmd + ("commit", "-a", "-m", "add whole repo")), - ("", RepomanRun(args=["full", "-d"])), - ("", RepomanRun(args=["full", "--include-profiles", "default/linux/x86/test_profile"])), + ("", RepomanRun(args=["full", "-d"], expected=expected_warnings)), + ("", RepomanRun(args=["full", "--include-profiles", "default/linux/x86/test_profile"], expected=expected_warnings)), ("", cp_cmd + (test_ebuild, test_ebuild[:-8] + "2.ebuild")), ("", git_cmd + ("add", test_ebuild[:-8] + "2.ebuild")), - ("", RepomanRun(args=["commit", "-m", "cat/pkg: bump to version 2"])), + ("", RepomanRun(args=["commit", "-m", "cat/pkg: bump to version 2"], expected=expected_warnings)), ("", cp_cmd + (test_ebuild, test_ebuild[:-8] + "3.ebuild")), ("", git_cmd + ("add", test_ebuild[:-8] + "3.ebuild")), - ("dev-libs", RepomanRun(args=["commit", "-m", "cat/pkg: bump to version 3"])), + ("dev-libs", RepomanRun(args=["commit", "-m", "cat/pkg: bump to version 3"], expected=expected_warnings)), ("", cp_cmd + (test_ebuild, test_ebuild[:-8] + "4.ebuild")), ("", git_cmd + ("add", test_ebuild[:-8] + "4.ebuild")), ("dev-libs/A", RepomanRun(args=["commit", "-m", "cat/pkg: bump to version 4"])),